My account: Login | Sign Up
Loading...

eventListener for a changed variable | Thread profile

Thread profile page for "eventListener for a changed variable" on http://www.kirupa.com. This report page is a snippet summary view from a single thread "eventListener for a changed variable", located on the Message Board at http://www.kirupa.com. This thread profile page shows the thread statistics for: Total Authors, Total Thread Posts, and Thread Activity, which are reported in a table below. Additional thread profile information is also shown in the following ways:

1) Top Contributing Authors
2) Related Threads on "eBay Auctions"
3) Related Threads on Other Sites

Warning: These statistics are generated using 'best efforts' and can experience delays and reporting errors at times. Please note that such statistics do not constitute a thread's popularity and/or exact posting volumes at any given reporting period.

Title: eventListener for a changed variable
Site: Kirupa Forum  Kirupa Forum - site profile
Forum: ActionScript 3.0  ActionScript 3.0 - forum profile
Total authors: 2 authors
Total thread posts: 14 posts
Thread activity: no new posts during last week
Domain info for: kirupa.com

Thread posts in eventListener for a changed variable:

1. 
Started 3 months, 1 week ago (2008-06-26 13:11:00)  by Yuu
So I'm confronted with a problem, that eventListener seems to be lacking to tools to directly over come. I've got a global variable, from a class that multiple SWFs I've got going share. I want fire off a function in a child, to be exact, the child of a child, SWF when that variable is changed by the parent. It seems to me an easy way to do this would be to have an eventListener than ...
Size: 986 bytes
Customize:  Customize "eventListener for a changed variable :: ActionScript 3.0 :: Kirupa Forum"
2. 
Started 3 months, 1 week ago (2008-06-26 13:34:00)  by Anogar
Hi there Yuu, A good way to do this sort of thing is a public set function. What this does is it allows you do dispatch events, check for conditionals, manipulate the input, etc. It looks something like this. ActionScript Code: public function set myVariable ( input: int ) : void { _myVar = input; dispatchEvent ( new Event ( "myVarChanged" ) ) ; }...
Size: 4,054 bytes
Customize:  Customize "<b>Reply 1</b>: eventListener for a changed variable :: ActionScript 3.0 :: Kirupa Forum"
3. 
Started 3 months, 1 week ago (2008-06-26 14:47:00)  by Yuu
Thanks, it's getting me on a track - but I can't finish thing out yet. Long story short I've got a parent that loads a child (child1.swf) that child loads other swfs (child1_1.swf). I've got parent set up to listen for a Resize, then set a global variable in a class (MyGlobalVars). I need child1_1 to also respond to that resize - I think I'm failing with the eventListener in child1_1. I...
Size: 2,539 bytes
Customize:  Customize "<b>Reply 2</b>: eventListener for a changed variable :: ActionScript 3.0 :: Kirupa Forum"
4. 
Started 3 months, 1 week ago (2008-06-26 14:50:00)  by Anogar
You're not actually setting the global variable with the set function. Put the set function inside the MyGlobalVars class.
Size: 161 bytes
Customize:  Customize "<b>Reply 3</b>: eventListener for a changed variable :: ActionScript 3.0 :: Kirupa Forum"
5. 
Started 3 months, 1 week ago (2008-06-26 15:05:00)  by Yuu
Thanks for the quick response(s) Ok, that's what I thought at first, but for some dumb reason I decided to make it difficult. I've got an issue with the package now: "1180: Call to a possibly undefined method dispatchEvent." I'm probably being very dense.., at least feel like it. Code: package { import flash.events.Event; import flash....
Size: 1,263 bytes
Customize:  Customize "<b>Reply 4</b>: eventListener for a changed variable :: ActionScript 3.0 :: Kirupa Forum"
6. 
Started 3 months, 1 week ago (2008-06-26 15:43:00)  by Anogar
Try having MyGlobalVars extend EventDispatcher.
Size: 86 bytes
Customize:  Customize "<b>Reply 5</b>: eventListener for a changed variable :: ActionScript 3.0 :: Kirupa Forum"
7. 
Started 3 months, 1 week ago (2008-06-26 16:24:00)  by Yuu
Thanks, that cured that error. But I'm still not at all sure how to trigger the function in my class from the timeline of the parent, and in turn have it set off a listener in child1_1 If I could figure out how to get the function in the class triggered, I think I can get the child going. But this is my 1st time working with this manner of script, and I'm just not grasping something. ...
Size: 1,194 bytes
Customize:  Customize "<b>Reply 6</b>: eventListener for a changed variable :: ActionScript 3.0 :: Kirupa Forum"
8. 
Started 3 months, 1 week ago (2008-06-26 16:48:00)  by Anogar
You need to be accessing the setter when you set it, not the variable. Like this: ActionScript Code: MyGlobalVars. myVariable = stage . stageWidth Add the listener to the MyGlobalVars class, like this: ActionScript Code: MyGlobalVars. addEventListener ( "myVarChanged" , doSomething ) ;
Size: 1,266 bytes
Customize:  Customize "<b>Reply 7</b>: eventListener for a changed variable :: ActionScript 3.0 :: Kirupa Forum"
9. 
Started 3 months, 1 week ago (2008-06-26 17:08:00)  by Yuu
I've got to be an idiot or something... I'm trying to follow what you're telling me - but all I get is errors. I think I need a punch in the brain or something. Am I just hopeless? Below is what I've got - I get errors in both the class and timeline codes now MyGlobalVars Class Code: package { import flash.events.Event; import flash.events....
Size: 1,984 bytes
Customize:  Customize "<b>Reply 8</b>: eventListener for a changed variable :: ActionScript 3.0 :: Kirupa Forum"
10. 
Started 3 months, 1 week ago (2008-06-26 17:09:00)  by Anogar
Wait, no, add the event listener to wherever you want the interaction to happen, not to the Global class.
Size: 144 bytes
Customize:  Customize "<b>Reply 9</b>: eventListener for a changed variable :: ActionScript 3.0 :: Kirupa Forum"
 

Top contributing authors for eventListener for a changed variable

Name Posts
Yuu 8
Anogar 6