Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Preventing Clicks From Bubbling Through Movie



I have a tree menu that serves as a file explorer. Users can click on the icon next to an item's label to call up a context menu for that item. I have a problem in that when the context menu is displayed (on top of the tree) the clicks seem to pass right through the context menu to the tree, firing events.

How can I keep this from happening????



FlashKit > Flash Help > Flash MX
Posted on: 09-03-2002, 03:22 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Preventing Underlying Button Clicks
I have a site i'm working on that has a thumbnailed gallery for images. When you click a thumbnail it brings up a smaller window off to the side that displays the info for the image (name, description and price) When you click the link to view the full size image file, I have it making an empty clip above the site that covers everything. My problem is that the thumbnails and the rest of the links on the site are under this full view and the hand cursor comes up when you roll over them, even tho they are not visible. Is there a way to prevent this? The site is here: http://www.gusfink.com/flash_site/

Thanks in advance for any help you can offer.

Ryan - 7 Year Studios

Preventing Objects Underneath Others From Receiving Mouse Clicks
Hi,

Is there a way to prevent an object (movieclip, button, etc) from receiving a mouse click (onPress) event when there's another object on top of it?

In my case I have some buttons on the screen, and when another movieclip is placed on top of them, I don't want the buttons to receive any mouse event.

Expandable Z-indexed SWF Preventing Clicks On HTML Links
I am trying to figure out whether resizing with javascript is my best bet. I have swf that uses z-index and is wmode=transparent. The SWF which is 300x274 has a visible area of 300x100 on frame1 of an mc that on rollover goes to frame2 where the visible content is 300x274. The bottom 174 pixels overlay HTML links. In IE these links are clickable. In Safari & FF the expandable transparent area of the SWF, prevents clicks on the links, and there is no cursor. I am looking at flash_resize.js but am unsure how to bend it to suit my situation. Also wondering if there is another way to approach this with either jquery or scriptaculous.

Here is my AS


Code:
box_mc.onMouseDown = function():Void
{
getURL("javascript:pageTracker._trackPageview('/flash/click/');");
getURL("http://www.yahoo.com","_blank");
};

box_mc.onRollOver = function():Void
{
getURL("javascript:pageTracker._trackPageview('/flash/rollover/');");
box_mc.gotoAndPlay(2);
};

box_mc.onRollOut = function():Void
{
box_mc.gotoAndStop(1);
};

Preventing Mouse Clicks In A Shooting Game (ie Reloading)
Or if I want to adjust a rate of fire so if I "shoot", I have to wait a certain amount of time before I can "shoot" again...

Can anyone explain how to?

Preventing Movie From Being Loaded...
Hey guys,
long time since ive been here last... well gotta problem according to the page i created for my band...

i am working on a such called "picssection" were you can look at pictures taken from our band...
the fact is that the pictures (though the single pic is only about 20kb big) sum up to a high amount of space and of course all this data hast to be loaded at the beginning of my movie

My question is now: Is there a way to prevent this part of my movie (ill call the whole movie amp for easier writing) wont be loaded at the beginning but only if somebody wants to see that section of the amp?

I tried it with a preloader i use at the beginning of my amp-animations... but it doesnt work, how hard i even try...

I would really appreciate fast help because im hot to go on flashin

Thx anyways, Chris

Btw: if you want to, check out our page Affected - Let Us Affect You (im still workin on it, but im sure youll get a basic impression!)

Preventing Auto-scaling Of A Movie..
I'm used to director... when you set a stage size, that's what you get.. new to flash, I knew flash had the CAPABILITY to scale to the window open, but didn't expect it to be default...

My project is designed to be a specific size.... so how do i keep it from scaling up to fill the browser window?

thx in adavance...

Preventing A Movie Clip From Resizing
Hello:

How can I prevent a movie clip from resizing while continuing to allow the main movie to resize.
If this is impossible to do, knowing that would also be helpful information.

Thank you in advance for any assistance offered,

MyMorgaine

Preventing Dynamic Mp3 From Slowing Movie Down
Hey everyone, I hope someone has some prior experience on this one...

Here's what I wanted to do. I want to trigger events in a presentation-like Flash movie using dynamic mp3 files.

So, in Flash MX, I created a sound object from a dynamically loaded mp3 file. Using the sound.position property, I want to cue in certain events. For example, I have a stop() command at frame 100 and I don't want the playhead to advance to frame 101 onwards until sound.position is at a specified spot in the mp3 file.

So,...what I did was, I created an empty while loop that executes after the stop(), and right below the loop is a play() command. This worked accurately, but the problem is, the loop seems to be eating so much CPU, that the whole thing slows down. The audio plays fine, but all movies become choppy and consequently, off-mark on those triggers.

Does anyone have any suggestions besides using a loop?

Could it be the streaming, dynamically-loaded mp3 file that is really slowing down the CPU?

I'd appreciate any insight. Thanks in advance.

minsan

Preventing A Movie Clip From Playing
I have a movie clip symbol with an animation that i want to execute later after an instance of it is created in the main movie... now without doing anything it would play it as soon as you create an instance of it..

but i need it to be halted as soon as it is initiated..

in the movie clip i made an actions layer, and set the first frame to do a "stop();" however this stops playback of the entire movie as i recently discovered, i also tried movieclipname.stop() and instancename.stop() in the same place, it had no effect..

can anyone help ? imm using MX

Preventing Button From Reloading Movie
Sorry I know this is not really a problem, jus something id like to do.

When you press any of the button they keep reloading their assigned movie onto the root movie even though it is currently visible and occupying the target.

the actins on the buttons are simply this (home button)

on (release) {
_root.content.loadMovie("home-clip.swf");
}

Please see the file. http://www.fxstorm.com

what actions should I add to make the buttons realise it's assigned movie is currently loaded and active, thus, shouldn't be reloaded.

"content" is the target area of the main movie, the buttond are also loaded onto a seperate taget area.

Thanks in advace for all your help

Flash Movie Is Preventing Navigation Away From Page
Hi everyone. I'm sure this is an easy answer, but I don't even know where to begin. I have an swf that I imported a video using the wizard and a stock external player. I've included this on an html page on one of my sites, and now, when a user clicks on a link to go to a different page on the site, the browser is waiting for the entire attached .flv file to download before it will move to the next page! Anyone know what's happening?

Thanks in advance.

Noob Question -- Preventing A Movie From Playing
I'm new at this, so this is probably pretty basic, but here's what I can't figure out.

Just trying to figure out some scripting, I created a doc with a button in the middle of the stage, and a movie clip that plays two "sliding doors" closing and opening on the stage. On my main timeline I have three layers- one for the button, one for the movie clip, and one for the actions. All of the content is on frame 1. I was able to figure out how to play the movie by clicking the button, but my problem is that when I test the movie, the doors open and close as soon as the page loads, and then only when I click the button. How can I prevent the movie clip from playing right away on load?

Thanks!

Preventing Movie Clip Moving Off Frame
Hi I have a movieclip called soldierriver. Is can be moved around the stage by using the cursor keys. What I want is to prevent him from be moved off the stage. I know with drag and drop you use
startDrag(this,true,0,0,500,400);

But I don't know how to add this into the code I am using for the cursor keys which is as follows.

onClipEvent(enterFrame) {
if (Key.isDown(Key.RIGHT)) {
_root.soldierriver._x++;
}

if (Key.isDown(Key.LEFT)) {
_root.soldierriver._x--;
}

if (Key.isDown(Key.UP)) {
_root.soldierriver._y--;
}

if (Key.isDown(Key.DOWN)) {
_root.soldierriver._y++;
}


Can someone please tell me how to include it in my code?
Cheers
Lesley

Preventing Movie Clip Moving Off Frame
Hi I have a movieclip called soldierriver. Is can be moved around the stage by using the cursor keys. What I want is to prevent him from be moved off the stage. I know with drag and drop you use
startDrag(this,true,0,0,500,400);

But I don't know how to add this into the code I am using for the cursor keys which is as follows.

onClipEvent(enterFrame) {
if (Key.isDown(Key.RIGHT)) {
_root.soldierriver._x++;
}

if (Key.isDown(Key.LEFT)) {
_root.soldierriver._x--;
}

if (Key.isDown(Key.UP)) {
_root.soldierriver._y--;
}

if (Key.isDown(Key.DOWN)) {
_root.soldierriver._y++;
}


Can someone please tell me how to include it in my code?
Cheers
Lesley

Handling Double Clicks And Mis-clicks In AS3
Hi

I am making point n clicked based game. From time to time my moving objects stop and I assume this is happening due to me not handling double mouse clicks and mouse mis clicks. I would like to know how I can handle double click and mis clicks in AS3.

Thanks

P.S. To get a better understanding of what I mean, play my game at:

http://freelancer.987mb.com/download/fla/Gool/Gool.html

Its still under development.

[F8] Tracking Clicks Within A Movie
Hi Folks;

I'm not new to Flash - but I AM new to scripting.

I don't know where to begin, so I'm throwing this out there.

I'm creating a simple "game" for pre-schoolers, in which they identify "hazards" in a room. When they click on a hazard (in an image)., it says "Correct" and explains the hazard, and it adds ONE to their score.

When the score for this room reaches 5 (5 indiviual hazards, not the same hazard 5 times). They earn a key to the next room.

Where do I even start to code this? Can anyone explain the concept I'm looking for and point me to a similar script?

Thanks!

Korman

Movie Keeps Stopping After 45 Clicks
Hi,
My flash movie keeps stopping after I've clicked 45 times and I've no idea why. There are lots of buttons on the page and when you click them they count how many times the buttons has been clicked and display this in a dynamic text box underneath the button. Not very exciting I know, but very useful at school. When I've clicked one button 45 times or a combination of buttons adding up to 45 the movie goes white (my buttons disappear). I'm quite new to flash so sorry if this is really basic.
Thanks,
Zoro

Tracking Clicks On A Flash Movie
Hi All,

My company is creating a series of Flash emails using the sattionary feature in Outlook and Outlook express. These are HTML pages with the Flash movie residing on a server.

Users must click a button in order to play the animation. My question is:

How do you track that click?

I know there must be some simple script somewhere and I probably have to keep a database.... I have been looking but I can't find anything simple enough.

All I want is to count the number of times this Flash piece has been played.... Thats it

thanks

Clicks Don't Work In Loaded AS2 Movie
While updating a project developed entirely in AS2, I needed to add AS3 components. Rather than recode my project, I decided to access both the AS2 project and the AS3 components via 2 movies loaded into an AS3 container using the Loader class. I used LocalConnection to fire the AS3 component-related events from my AS2 movie.

So all was well with the world, I felt very pleased with myself - my AS2 movie worked, and I got the AS3 components I wanted without spending a month recoding.

However....

My loaded AS2 movie contains several on release methods, which trigger a function inside the AS2 movie that uses localconnection to load a second AS3 movie with the AS3 components. Confusing, huh? I know I was... The container would then look like this:

AS3 Container
|
|(using Loader)
|
--->AS2 Movie
| |(localconnection via function inside "on Release" method )
| v
-->AS3 Movie(containing AS3 Components)


The problem is that AS3 doesn't acknowledge the "on Release" method - clicks that should trigger loading the second movie into the AS3 conainer are being ignored. Even trace messages aren't possible.

I will post the relevant code for both the AS3 container loader and the AS2 on clip events I am trying to fire in my AS2 movie below. I would appreciate any help in figuring this out.

Thanks.

The AS3 container:


ActionScript Code:
var lc:LocalConnection = new LocalConnection();

lc.client = this;
lc.connect("__conn");
//
var splashmovie:Loader = new Loader();
addChild(splashmovie);
//
var splashmovie:Loader = new Loader();
addChild(splashmovie);
//
function loadsplash (movieurl:String,xloc:Number,yloc:Number) : void {
    splashmovie.unload();
    splashmovie.load(new URLRequest(movieurl));
    splashmovie.y = yloc;
    splashmovie.x = xloc;
}
//

The code for the onclip events in the external AS2 swf:
(The reason the onrelease code is written that way is because there is another hit area below it)



ActionScript Code:
function replacesplash(aParam) {
    var lc:LocalConnection = new LocalConnection();
    lc.send("__conn","loadsplash",aParam,"0","125");
    trace(aParam);
}
.
.
.

ActionScript Code:
onClipEvent (mouseMove) {
    this.onRollOut = function() {
        if (Number(_root.left._currentframe) == 30) {
            _root.left.gotoAndPlay(31);
        } else {
            _root.left.gotoAndPlay(60-_root.left._currentframe);
        }
    };
    this.onRollOver = function() {
        if (Number(_root.left._currentframe) == 1) {
            _root.left.gotoAndPlay(2);
        } else if (Number(_root.left._currentframe) == 30) {
            stop();
        } else {
            _root.left.gotoAndPlay(60-_root.left._currentframe);
        }
    };
    this.onRelease = function() {
        if ((this._ymouse>-14) & (this._ymouse<-7)) {
            //about
            _root.left.replacesplash("about.swf");
        } else if ((this._ymouse>-7) & (this._ymouse<0)){
            //contact
            _root.left.replacesplash("contact.swf");
        } else if ((this._ymouse>1) & (this._ymouse<8)) {
            //links
            _root.left.replacesplash("links.swf");
        } else {
            //trace command to see if mouse position is misaligned
            trace("mouse y: " + this._ymouse + ", mouse x: " + this._xmouse);
        }
};
}

Detecting Clicks Behind A Movie Clip
Hey all, I've searched through the forums but couldn't find the answer to my question, it might be completely obvious but I'm kind of stumped.

Is there a way to have a movie clip ignore clicks to it, but still be visible and accept Actionscript commands? Let me describe the situation:

I have a MovieClip set as the stage, which covers most of my movie.
I have a button which, when pressed, attaches a MovieClip to _root and makes it semi transparent. _root then has an EnterFrame handler which moves this semi transparent clip so that it's stuck to the mouse
I want to be able to click down on the stage and attach another MovieClip, but because I have this semi transparent clip following the mouse, I guess it steals the clicks because the stage clip isn't responding.

(this is basically an RTS style click and build, the semi transparent clip is showing you where it's going to build)

Am I doing this all wrong? Can anybody give me an idea of how this sort of thing is usually done?

Thanks.

Nested Movie Clips And Mouse Clicks
hey,
i have three movie clips A and B and C ( B and C are inside A ). A is on stage. Now when i click anywhere on stage, how do i check if i am clicking outside A or on B or C ?? ....
if regestration point of B and C is same, how do i get relative co-ordinates of mouse from that point ???
(plz help with usage of localToglobal in this case)

Bubbling
I was tracing out a Timer Event and saw that there were a few values I hadn't known about - one was bubbling, and it was set to false.

What's bubbling, and why would I use it in the instance of a timer?

Seems cool, my n00b programmer eyes just haven't seen that word before.

Thanks!

Bubbling?
I think my problem is called bubbling. I've tried reading Essential Actionscript 3 but being Dyxlesic making sense of isn't the easiest thing to do!

I'm trying to control a container - containing all my menus, I know the code works as I have used it else where in my project.

Could some kind soul also tell me what the heck it is in plain English.

Code:

//AT VERY TOP OF DOUCMENT CLASS >
      public var _mainContent:*;
      public var _contentSelect:*;
      public var _menuActive:*;
      public var _menuSystem:*;

function contentStart():void
            {
               trace ("contentStart");
               TweenMax.to (_mainContent, 1,{ autoAlpha:1, onComplete:openMe});
            }

            function openMe ():void
            {
               _menuSystem = site.mainContent.mContainer;
               for (var i:Number = 1; i < _menuSystem.numChildren; i++) {
                  _contentSelect = _menuSystem.getChildAt(i);
                  _contentSelect.addEventListener(MouseEvent.MOUSE_OVER, myMouseOver);
                  _contentSelect.addEventListener(MouseEvent.MOUSE_OUT, myMouseOut);
                  _contentSelect.addEventListener(MouseEvent.CLICK, fadeDown);
                  _contentSelect.buttonMode = true;
               }
            }


Regards
Mat

Making A Movie Dissapear When The User Clicks On The Screen?
I have a button that makes a movie apprear, (its a pop up menu). But I want to make the movie disappear when the user clicks anywhere else on the screen.
To make the movie pop up im using this code

on (press) {
tellTarget ("jump movie") {
gotoAndPlay(2);

}

}
Is there a way to make this work?
Thank for your help

Making A Movie Dissapear When The User Clicks On The Screen?
I have a button that makes a movie apprear, (its a pop up menu). But I want to make the movie disappear when the user clicks anywhere else on the screen.
To make the movie pop up im using this code

on (press) {
tellTarget ("jump movie") {
gotoAndPlay(2);

}

}
Is there a way to make this work?
Thank for your help

Bubbling Pointers?
How do you make the pointer of the mouse look like it is trailing things like bubbles or flowers etc.? an example of this is http://www.barbie.com where flowers trail the mouse.

Event Bubbling
Hi there,
AS2 doesn't have an event bubbling model. Does this mean there's no way to detect clicks on anything than the top-most movieclip?

In which case, AS3 is my only option?

Thanks,
Dave

Event Bubbling
Hi.
I have huge confusion on event bubbling.

The concept is:
I have a "search area" where in I give some criteria and do search.
I have a button called "Search" and on click event I should get the list of data matching with the given criteria in a different container say panel.
Now the question is:
Can I use Bubbling concept for this and how?

Event Bubbling
Hi,

Please let me know if this doesn't make sense...

I'm developing a series of sequencing classes. SequenceList has an array of Sequences. Each Sequence has an array of Steps. Each Step has an array of Conditions.

A Step dispatches a custom event (with bubbles set to true) when one of its conditions have been satisfied.

The parent Sequence doesn't receive the event unless I add the listener directly to the Step.

Inside class Sequence:

Code:
_array[_index].addEventListener...
Why doesn't the following work?!? Doesn't the event bubble to the Sequence because it originates from a item stored in a array property of the class?

Inside class Sequence:

Code:
this.addEventListener...
More importantly:

The document class contains the SequenceList intance(s). It controls which instance is active. I need to addEventListener directly to the SequenceList instance and have it receive events dispatched from any Sequence or Step. Shouldn't this work based on bubbling? What am I missing here?!?

As3 Event Bubbling
I've tried to find out more about what this means and how it works. Does bubbling go up a via parent of does it go up the event class? Can any give an example of when you would/would't use event bubbling? Thanks for your help!

Event Bubbling
So, I have an event with bubbling set to true, and I have a listener on an abstract "Page" Class and a listener for the same event on the concrete class (ExamplePage) that extends that "page" class. The event is fired from a child of the ExamplePage, why is it heard FIRST on the abstract class?

Shouldn't the concrete class extending the abstract class receive the event first?

I would like to have default actions on the abstract class and custom actions on the concrete class but in some scenarios, stop propagation of that event from bubbling up to the abstract class.

[as3] Bubbling Only For DisplayObjects?
I just have a simple question. Does event bubbling only work for DisplayObjects or classes extending DisplayObject? Do all of the objects being bubbled through need to be added to the display list as well?

I'm using Flex 3 and right now I have an ArrayCollection containing Deck's (Deck also extends ArrayCollection) which contains Cards (extending nothing). For an event to bubble from a Card to the main Application does each of those classes then have to extend a DisplayObject in some form and be added to the display list? I would like to then catch any CardEvents, say, on the main Application with the code this.addEventListener(CardEvent.MYCARDEVENT, cardEventHandler).

And incidentally, if it's true that only DisplayObjects can bubble events, why is this so? It seems like it would be handy to bubble events in any class.

Starting A Movie Clip Where Users Mouse Clicks A Button?
Hello,

I want Movie Clip A to start playing at the location where the user click on to button1.


Thanks for your help

Exception Bubbling And Events
i have a try-catch statement that i want to use to load an image.
here is the stripped down functionality:
// actionscript
this.onLoadError = function() {
throw new Error("onLoadError");
};
mcloader = new MovieClipLoader();
mcloader.addListener(this);
try {
mcloader.loadClip("fdjk.jpg", createEmptyMovieClip("test_mc", 1));
} catch (e) {
trace('Error = ' + e)
}
// end actionscript

if the image doesn't load, i'd like to throw an error, but the onLoadError function is outside the scope of the try and therefore the throw will not find the catch.

is there ANY way to get something like this to work????

Event Bubbling Confusion
Hi all.

Ok, i have made a custom event like so:-

Code:

package {
   
    import flash.events.Event;
    public class ViewChangeEvent extends flash.events.Event
   {
       public static const VIEW_CHANGE:String = "viewChanged";
       public var _viewID:Number;
      
      public function ViewChangeEvent(viewID:Number,type:String,bubbles:Boolean = true, cancelable:Boolean = false)
      {
         super(type,bubbles,cancelable);
         this._viewID = viewID;
      }
   
    }
}


In another class (which is a child of stage) i dispatch the event like this:

Code:

         var vEvent = new ViewChangeEvent(ViewChangeEvent.VIEW_CHANGE,_viewID);
         dispatchEvent(vEvent);


I have a listener on stage which works works fine:-

Code:

addEventListener(ViewChangeEvent.VIEW_CHANGE,viewChangeHandler);


So far so good, but i have another class, an instance of which is on the stage and it does not receive the event. In the class i have exactly the same as stage. I am a little confused as i thought the event bubbled from stage down to all children?

Movie Clip With Dynamically Loaded JPEGs Not Responding To Mouse Clicks
I have a movie clip called pictureframe that I am loading JPEGs into sequentially with a movieClipLoader. I want to be able to click on each JPEG and go to a different web site, but it's not working. The MC is not accepting mouse clicks. Here's the code I'm using:


Code:
this.pictureframe.onRelease = function() {
getURL("http://www.a_web_site.com");
}


If this were a normal movie clip with some content "hard coded" into it, it would work fine. It's gotta have something to do with the fact that it's a movie clip that's empty until it gets a JPEG loaded into it.

Child Propagation/bubbling Problem?
I'm in one heck of a pickle. I informed a client that i could build them this nifty little flash menu expecting that I would be able to figure out the process fairly easily. I'm passed the deadline, but bought myself time until tomorrow. Any help here would be oh-so awesome.

my fla is here: http://www.d-w-t.com/pom5.fla

If you test it, you can roll over 'about us' and a menu slides down. The problem is, this menu is completely non-functional. The item you roll over is supposed to turn black and take you to a link when you click on it. I havn't even gotten to turning it black because the actual link never works (currently, only 'our story' is set up). According to the rules of child propagation and bubbling, I think it should work - but I am, alas, a noob and obviously don't have a full understanding. The reason I feel it should work is because the on(rollOver) of the 'about us' works and that's in the same movie clip as the on(press) (and go to a url) button... so why would one work and not the other if the rules of child propagation/bubbling are preventing it...?

Please help. I'm desperate. Thanks.

Small Event Bubbling Question
So, if you look at the attached file you'll see that I would like to receive and interpret ROLL_OVER events from the button layered two children down into the movie clip on the stage. With event bubbling, that's easy enough to do with just a simple addEventListener. Unfortunately though, you'll notice that I'm receiving *two* mouse events, one from the button and one from the clip holding it. I don't really want an event from the one holding the button. I can work around it, but it's just noise that I have to account for in my code, and it's bothersome.

Is there some quick and easy way I can make that movie clip that holds the button stop dispatching ROLL_OVER events?

Event Bubbling, Workaround: Delegation
After reading senoculars button event caputuring (http://www.senocular.com/flash/tutor...ttoncapturing/)

I have been trying to get something to work using workaround #1 and I need some help.

I am trying to get a sound control tab (see attached file) to have a rollOver state which slides in and have buttons on tab be usable but cant seem to grasp the AS needed.

This is the AS but I know it is incorrect because it is not can anyone please help so that I can grasp this concept?


Code:
this.soundtab_mc.play_mc.onPress = function() {
_parent.sound_mc.songStarter(songfile[song_nr], songname[song_nr]);
soundtab_mc.onRollOverHandler()

/// How can I have this function for soundtab_mc work along with buttons within this MC?
/// this.gotoAndPlay(2);
/// }
/// soundtab_mc.onPressHandler() {
/// this.gotoAndPlay(15);
/// }
};
this.soundtab_mc.stop_mc.onPress = function() {
_parent.sound_mc.sound_obj.stop();
soundtab_mc.onRollOverHandler()
};
this.soundtab_mc.next_mc.onPress = function() {
(song_nr == songfile.length-1) ? _global.song_nr=0 : _global.song_nr++;
_parent.sound_mc.songStarter(songfile[song_nr], songname[song_nr]);
soundtab_mc.onRollOverHandler()
};
this.soundtab_mc.prev_mc.onPress = function() {
(song_nr == 0) ? _global.song_nr=songfile.length-1 : _global.song_nr--;
_parent.sound_mc.songStarter(songfile[song_nr], songname[song_nr]);
soundtab_mc.onRollOverHandler()
};
stop();
Thanks for any suggestions. MT

Events Bubbling Out Of Custom Classes?
Okay, I'm trying to create a job queue type of system that uses event bubbling so that events can be dispatched from multiple locations and bubble up to a front controller.

For some reason my EventHandler is never being called:
OUTPUT:
DataPack Constructed
Custom Event Constructed
EventTransporter Constructed
Dispatching event type: _dataevent

Does anyone see anything terribly wrong here?

TestEvents.as

Code:
package {
import flash.display.Sprite;

public class TestEvents extends Sprite
{
public function TestEvents()
{
addEventListener(CustomEvent.DATA_EVENT, onCustomEvent);

var myCaller:EventCaller = new EventCaller();

var myData:DataPack = new DataPack([1,2,3,4,5]);
var event:CustomEvent = new CustomEvent(CustomEvent.DATA_EVENT, myData);
var holder:EventTransporter = new EventTransporter(event);
myCaller.callEvent(holder);


}

private function onCustomEvent(event:CustomEvent):void
{
trace("onCustomEvent data: "+event.data);
}
}
}
DataPack.as

Code:
package
{
public class DataPack
{
private var _stuff:Array;

public function DataPack(ary:Array)
{
trace("DataPack Constructed");
_stuff = ary;
}

public function get stuff():Array { return _stuff }
}
}

EventCaller.as

Code:
package
{
import flash.events.EventDispatcher;

[Event(name="_dataevent", type="CustomEvent")]
public class EventCaller extends EventDispatcher
{
public function EventCaller() {}

public function callEvent(holder:EventTransporter):void
{
trace("Dispatching event type: "+holder.event.type);
dispatchEvent(holder.event);
}
}
}
EventTransporter.as

Code:
package
{
public class EventTransporter
{
private var _event:CustomEvent;

public function EventTransporter(event:CustomEvent)
{
trace("EventTransporter Constructed");
_event = event;
}

public function get event():CustomEvent { return _event }
}
}
CustomEvent.as

Code:
package
{
import flash.events.Event;

public class CustomEvent extends Event
{
public static const DATA_EVENT:String = "_dataevent";

private var _data:DataPack;

public function CustomEvent(type:String, data:DataPack)
{
trace("Custom Event Constructed");
super(type, true);
_data = data;
}

public function get data():DataPack { return _data }
}
}

No Event Bubbling Through Animated Bitmaps
bubbling events through a hierarchy of nested DiplayObjects works in many cases but
unfortunately it does seem to work not in all cases:

Given some nested Objects like so:

box = new Sprite();
box.addChildAt(containerA,0);
box.addChildAt(containerB,1);
box.addChildAt(containerC,2);

whereas containerA has some "clickable" Objects inside.

If containerB/C contain bitmaps, for instance, the event bubbling works.
But if containerB/C contain a bitmap with a bitmapData which is manipulated via setPixel
or other pixel changing methods, there is NO event bubbling any more.

My first guess was that has something to do with lock() or unlock() the bitmapData, But it hasn't.

Does someone know why there is no event bubbling in such a case

Keith

Event Propagation/bubbling Question
i can't doubleclick on an mc with mc's init...the main container mc won't register doubleclick events(it does so with single clicks)...is this a propagation issue and what can be done?(some property or method)...and i cant wrap my head around event bubbling(phases and such)...i guess this and the doubleclick hick up are connected , no?...many thanx for any replies

Child Propagation/bubbling Problem?
I'm in one heck of a pickle. I informed a client that i could build them this nifty little flash menu expecting that I would be able to figure out the process fairly easily. I'm passed the deadline, but bought myself time until tomorrow. Any help here would be oh-so awesome.

my fla is here: http://www.d-w-t.com/pom5.fla

If you test it, you can roll over 'about us' and a menu slides down. The problem is, this menu is completely non-functional. The item you roll over is supposed to turn black and take you to a link when you click on it. I havn't even gotten to turning it black because the actual link never works (currently, only 'our story' is set up). According to the rules of child propagation and bubbling, I think it should work - but I am, alas, a noob and obviously don't have a full understanding. The reason I feel it should work is because the on(rollOver) of the 'about us' works and that's in the same movie clip as the on(press) (and go to a url) button... so why would one work and not the other if the rules of child propagation/bubbling are preventing it...?

Please help. I'm desperate. Thanks.

Interesting Movie Clip Speed Change Depedant On Time Between Mouse Clicks
I've set up a crude but entertaining link between my rowing machine and my PC with an old mouse and flash. Flash records and processes the mouse clicks for information and also displays a rower moving accross the screen in increments with the mouse clicks.

My problem is that for completion I would like to get the rower moving in time. I can get him to start a stroke at every click but he starts a new stroke even if he hasn't finished the last one as it depepends how fast i'm rowing. I would really like to vary the time it takes for him to finish the stroke.

I wanted to record the time between two mouse clicks and then get the rower to row his next stroke for the same duration. So if it takes 2 seconds to do a stroke (2 seconds between mouse clicks) the rowers next stroke takes 2 seconds, if it takes 1 second for a stroke (1 second between mouse clicks) the rower takes 1 second (the clip plays for 1 second)

I was thinking about advancing each frame a after a dynamic number of seconds which changed relative to the time between mouse clicks.

The rowers stroke sequence is a tween moving backwards and forwards of 20 frames.

Any ideas???

Thanks in advance

Newbie..needs Some Help And Explaination On Possible Bubbling(sp?) Problem In Submenu
Hi. First post of course it's a problemquestion. I've spent around five hours reading forums and help topics and I believe I have a bubbling (sp?) problem and I am obviously not sure how to fix it.

I'll be specific as possible and you can look at the page here
http://www.financialmanagementgroupl...ment_menu.html

and download the FLA zip here
http://www.financialmanagementgroupl...ement_menu.rar

My problem is this:
I have created a menu on scene 1 in a movie clip
inside the clip I have created the buttons for the main menu and 2 sub menus as movie clips the sub menus are called up by labels on rollover of thier parent buttons on the main menu. I need the parent button (Project Advice) to be clickable as well as the sub menu buttons. However at this point I can not get the submenu buttons (the New England button (new_btn)) to properly link to a label in scene one (New England). Any help or explaination would be awsome, or even just a quick link to a good tutorial/info about the problem. Thanks for any help.

EDIT: I just wanted to add that I was following a tutorial from learnflash.com that told me to build a menu this way, but did not explain how to create links in the submenu.

-J. Sheehan

Newbie..needs Some Help And Explaination On Possible Bubbling(sp?) Problem In Submenu
Hi. First post of course it's a problemquestion. I've spent around five hours reading forums and help topics and I believe I have a bubbling (sp?) problem and I am obviously not sure how to fix it.

I'll be specific as possible and you can look at the page here
http://www.financialmanagementgroupl...ment_menu.html

and download the FLA zip here
http://www.financialmanagementgroupl...ement_menu.rar

My problem is this:
I have created a menu on scene 1 in a movie clip
inside the clip I have created the buttons for the main menu and 2 sub menus as movie clips the sub menus are called up by labels on rollover of thier parent buttons on the main menu. I need the parent button (Project Advice) to be clickable as well as the sub menu buttons. However at this point I can not get the submenu buttons (the New England button (new_btn)) to properly link to a label in scene one (New England). Any help or explaination would be awsome, or even just a quick link to a good tutorial/info about the problem. Thanks for any help.

EDIT: I just wanted to add that I was following a tutorial from learnflash.com that told me to build a menu this way, but did not explain how to create links in the submenu.

-J. Sheehan

Senoculars Event Bubbling With Buttons Issue
Here's some neat coding developed by senocular (thanks a lot!), that "allows child clips to receive events despite the fact that a parent might make use of them as well, something not possible with the normal convention of handling button events where no child movie clip ever receives button events if a parent has any button event handlers defined for it."

Yeah! It's neat.

But I can't really figure out how to attach an event to an mc called "child_next" within "parent1".

Can anybody help me out?









Code:
import com.senocular.events.*

function handleEventMethod(eventObject:ButtonEvent):Void {
// trace event
if (eventObject.type != "onMouseWithin") trace(eventObject.type +"("+this+")");

// stop event from bubbling up to parent clips if this clip is parent2.child
if (this.target == parent2.child) eventObject.stopPropagation();

// react based on which event is being received.
switch(eventObject.type){
case "onRollOver":
case "onDragOver":
// this.target.gotoAndStop(2);
this.target.play();
break;
case "onDragOut":
case "onRollOut":
case "onReleaseOutside":
// this.target.gotoAndStop(1);
this.target.play();
break;
case "onMouseWithin":
break;
//
}
}

// clips to receive events from ButtonEventHandler
var clips:Array = [parent1, parent1.child_prev, parent1.child_next];
var clip:MovieClip;
var buttonEventObj:ButtonEvent;

// allow events to pass through despite overlapping
ButtonEventHandler.overlapBlocksEvents = false;

// assign handleEventMethod as handleEvent handler for each clip in clips
for (clip in clips) {
// get ButtonEvent object for each clip and assign handleEvent function
buttonEventObj = ButtonEventHandler.getEventObject(clips[clip]);
buttonEventObj.handleEvent = handleEventMethod;

// for parent1, set overlapping to block events
if (clips[clip] == parent1) buttonEventObj.overlapBlocksEvents = true;

// enable the hand cursor by providing a null onPress event handler
clips[clip].onPress = null;
}

Bubbling Up Somehow Without Actual Event Redispatching Implementation?
Hey guys,

I've got 3 classes. Class C is instantiated in Class B and Class B is instantiated in Class A.

I want an event to dispatch in Class C and get handled in the Document Class where Class A is instantiated. Is there a way besides, actually doing a dispatchEvent in C,B,A and applying listeners to all 3.

Does the Event MetaTag help with this in flash?

Type Coercion Failed -- When Bubbling A Custom Event
I have a main actionscript app that loads a separate SWF file. The loaded swf file dispatches an event when a button is clicked. The event, however, is a custom event of a type that is in an external library (the type is mf.events.LocaleEvent).

Both the main actionscript project and the loaded swf file reference the same external library when referencing the event, but when the main project receives the event from the loaded swf, it throws the following error:

TypeError: Error #1034: Type Coercion failed: cannot convert mf.events::LocaleEvent@2e1e7891 to mf.events.LocaleEvent.
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at BottomSkin_fla::MainTimeline/buttonClicked()

Any ideas on how to make the app realize that both swfs are really pointing to the same class?

Thanks in advance for the help!

Copyright © 2005-08 www.BigResource.com, All rights reserved