[Flashcoders] Timer (AS3 newbie question)
Hi list... [finally migrating to AS3] What would be a good way of going about having many sprites move across the screen at different rates? I have a random number (0-5) that I want to use as a coefficient for each sprite's speed. My thought is to base the movement off of Timer events corresponding to each sprite, but is there a way of associating a timerEvent to targets? Thanks, - Michael M. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] How to access var passed in URL from AS2 class
Hi there, I'm passing a variable to my swf through a query string like this: htp://www.mydomain.com/index.html?passedPage=180 I have my main AS2 class that is the root class and have tried to access the variable like this: trace(PASSPAGE SET:+this[passedPage]); trace(PASSPAGE SET:+_level0.passedPage); trace(PASSPAGE SET:+_root.passedPage); each of these traces returns undefined. I am compiling this SWF using MTASC which means I can't write the var as passedPage as MTASC says this is an unknown variable. I have tried declaring passedPage as a public variable within the class though I still can't access it. Any suggestions much appreciated. Thanks Ali ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] How to access var passed in URL from AS2 class
I think you're passing the vars to the html page, but not the swf. You can use flashvars or just append a querystring to the swf url and you should be able to trace them Cheers Juan Pablo Califano. 2008/12/16 Ali Drongo alidro...@googlemail.com Hi there, I'm passing a variable to my swf through a query string like this: htp://www.mydomain.com/index.html?passedPage=180 I have my main AS2 class that is the root class and have tried to access the variable like this: trace(PASSPAGE SET:+this[passedPage]); trace(PASSPAGE SET:+_level0.passedPage); trace(PASSPAGE SET:+_root.passedPage); each of these traces returns undefined. I am compiling this SWF using MTASC which means I can't write the var as passedPage as MTASC says this is an unknown variable. I have tried declaring passedPage as a public variable within the class though I still can't access it. Any suggestions much appreciated. Thanks Ali ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] How to access var passed in URL from AS2 class
http://www.mydomain.com/index.html?passedPage=180 This won't pass into flash as a flashvar. You have a few options though. - Use Javascript to grab the query string and then write it in as a flashvar or query string to the swf. (ex: MySwf.swf?passedPage=180 - Make an ExternalInterface call a javascript function that returns the variables to you. - Auto populate the flashvar with a serverside language: php, cf, jsp... etc - If you're using Flex, look into BrowserManager. Cheers, Nate On Tue, Dec 16, 2008 at 8:12 AM, Ali Drongo alidro...@googlemail.comwrote: Hi there, I'm passing a variable to my swf through a query string like this: htp://www.mydomain.com/index.html?passedPage=180 I have my main AS2 class that is the root class and have tried to access the variable like this: trace(PASSPAGE SET:+this[passedPage]); trace(PASSPAGE SET:+_level0.passedPage); trace(PASSPAGE SET:+_root.passedPage); each of these traces returns undefined. I am compiling this SWF using MTASC which means I can't write the var as passedPage as MTASC says this is an unknown variable. I have tried declaring passedPage as a public variable within the class though I still can't access it. Any suggestions much appreciated. Thanks Ali ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Timer (AS3 newbie question)
Why use a timer? It is not necessary to do it on exact time because you use a random. So in this case Event.ENTER_FRAME would do the trick for you. HTH Cor -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Mendelsohn, Michael Sent: dinsdag 16 december 2008 16:10 To: Flash Coders List Subject: [Flashcoders] Timer (AS3 newbie question) Hi list... [finally migrating to AS3] What would be a good way of going about having many sprites move across the screen at different rates? I have a random number (0-5) that I want to use as a coefficient for each sprite's speed. My thought is to base the movement off of Timer events corresponding to each sprite, but is there a way of associating a timerEvent to targets? Thanks, - Michael M. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders No virus found in this incoming message. Checked by AVG - http://www.avg.com Version: 8.0.176 / Virus Database: 270.9.18/1851 - Release Date: 16-12-2008 8:53 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Re: A funny little hover problem with CSS
On Dec 14, 2008, at 8:04 PM, Ashim D'Silva wrote: Right. I recreated everything slowly in a new file, introducing things one by one and here's the culprit - Advanced Anti-Aliasing.Now I really would like to use advanced, because text looks dramatically better, but there has to be a solution, doesn't there? The issue affects more than just static fields (with hovers). It dramatically affects applications where users are allowed to rotate and scale dynamic text fields. In that instance, the kerning, leading and character positions are offset and randomly jump around in value. The kerning is the worst - as a field is scaled the kerning will jump anywhere between 0-2 em on the characters ... randomly between each. The only work around is to have the text field rotated by a small amount (0.01, for example). I submitted this bug to Adobe quite while back, along with the 'workaround.' Sorry to be the bearer of bad news. At least you can give the rotation of the field a shot. You may need to use AS to set the rotation via a Matrix. var m:Matrix = new Matrix(); m.rotate(0.01); myTextfield.transform = m; The rotaion might need to be tweaked a tad - I don't have my bug app open right now to check out the exact value that I ended up using. - jon ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Timer (AS3 newbie question)
Without getting too technical, you don't want to use timers move things. You want to use frames instead of timers. Save yourself some headache and don't use timers for movement. (unless you're using them to invalidate properties and such, but that's a more complex topic) Now if you want the things to run at different speeds, you could do something like this: var ball1Speed:int = 4; var ball2Speed:int = 2; addEventListener(Event.ENTER_FRAME, onEnterFrame); function onEnterFrame(event:Event):void { ball1.x += ball1Speed; ball2.x += ball2Speed; } Also from a resource standpoint, say you have 500 sprites on the screen. You don't want 500 timers, that will take too many resources. HTH, Nate On Tue, Dec 16, 2008 at 7:09 AM, Mendelsohn, Michael michael.mendels...@fmglobal.com wrote: Hi list... [finally migrating to AS3] What would be a good way of going about having many sprites move across the screen at different rates? I have a random number (0-5) that I want to use as a coefficient for each sprite's speed. My thought is to base the movement off of Timer events corresponding to each sprite, but is there a way of associating a timerEvent to targets? Thanks, - Michael M. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] problem with loadMovie
Hi there, can anybody tell me why the second line of code given here, loads the image perfectly into the holder-clip, and the other method won't work? ActionScript Code: _root[clicked_Button].picholder_mc.loadMovie(getPlayerInfo(surname, _root[this._name].name_txt.text).toLowerCase() + _set.png); _root[def_btn_4].picholder_mc.loadMovie(getPlayerInfo(surname, _root[this._name].name_txt.text).toLowerCase() + _set.png); the variable clicked_Button is a String-Variable and stores the instance-name of the movieclip pressed, e.g. def_btn_4 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Timer (AS3 newbie question)
addEventListener(Event.ENTER_FRAME, onEnterFrame); function onEnterFrame(event:Event):void { ball1.x += Math.round(Math.random()*5); ball2.x += Math.round(Math.random()*5); } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] How to access var passed in URL from AS2 class
You can also use SWF Object to embed the movie... I believe you have the options or grabbing vars form the query string. Makes it quite easy: The SWFObject script also comes with an extra function which allows you to pull variable values from the url string. An example is you have a url that looks like this: http://www.example.com/page.html?variable1=value1variable2=value2. Using the function getQueryParamValue() you can easily pull these values from the url and then pass them into your Flash movie. Here is an example, we'll assume that the url looks like the above example: script type=text/javascript var so = new SWFObject(movie.swf, mymovie, 400, 200, 8, #336699); so.addVariable(variable1, getQueryParamValue(variable1)); so.addVariable(variable2, getQueryParamValue(variable2)); so.write(flashcontent); /script Take care -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Nate Beck Sent: Tuesday, December 16, 2008 10:35 AM To: Flash Coders List Subject: Re: [Flashcoders] How to access var passed in URL from AS2 class http://www.mydomain.com/index.html?passedPage=180 This won't pass into flash as a flashvar. You have a few options though. - Use Javascript to grab the query string and then write it in as a flashvar or query string to the swf. (ex: MySwf.swf?passedPage=180 - Make an ExternalInterface call a javascript function that returns the variables to you. - Auto populate the flashvar with a serverside language: php, cf, jsp... etc - If you're using Flex, look into BrowserManager. Cheers, Nate On Tue, Dec 16, 2008 at 8:12 AM, Ali Drongo alidro...@googlemail.comwrote: Hi there, I'm passing a variable to my swf through a query string like this: htp://www.mydomain.com/index.html?passedPage=180 I have my main AS2 class that is the root class and have tried to access the variable like this: trace(PASSPAGE SET:+this[passedPage]); trace(PASSPAGE SET:+_level0.passedPage); trace(PASSPAGE SET:+_root.passedPage); each of these traces returns undefined. I am compiling this SWF using MTASC which means I can't write the var as passedPage as MTASC says this is an unknown variable. I have tried declaring passedPage as a public variable within the class though I still can't access it. Any suggestions much appreciated. Thanks Ali ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Timer (AS3 newbie question)
In AS2, I would have made a component with a parameter for speed. I'm just not sure how to do that in AS3, so I was guessing with a timer, I could add and event listerner to dispatch an event to the target, but I guess not. Thanks! - MM -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Cor Sent: Tuesday, December 16, 2008 11:49 AM To: 'Flash Coders List' Subject: RE: [Flashcoders] Timer (AS3 newbie question) Why use a timer? It is not necessary to do it on exact time because you use a random. So in this case Event.ENTER_FRAME would do the trick for you. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] How to access var passed in URL from AS2 class
Hey that's cool, I didn't know that existed. Thanks whispers! -- Cheers, Nate http://blog.natebeck.net On Tue, Dec 16, 2008 at 9:08 AM, whispers whispers...@hotmail.com wrote: You can also use SWF Object to embed the movie... I believe you have the options or grabbing vars form the query string. Makes it quite easy: The SWFObject script also comes with an extra function which allows you to pull variable values from the url string. An example is you have a url that looks like this: http://www.example.com/page.html?variable1=value1variable2=value2. Using the function getQueryParamValue() you can easily pull these values from the url and then pass them into your Flash movie. Here is an example, we'll assume that the url looks like the above example: script type=text/javascript var so = new SWFObject(movie.swf, mymovie, 400, 200, 8, #336699); so.addVariable(variable1, getQueryParamValue(variable1)); so.addVariable(variable2, getQueryParamValue(variable2)); so.write(flashcontent); /script Take care -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Nate Beck Sent: Tuesday, December 16, 2008 10:35 AM To: Flash Coders List Subject: Re: [Flashcoders] How to access var passed in URL from AS2 class http://www.mydomain.com/index.html?passedPage=180 This won't pass into flash as a flashvar. You have a few options though. - Use Javascript to grab the query string and then write it in as a flashvar or query string to the swf. (ex: MySwf.swf?passedPage=180 - Make an ExternalInterface call a javascript function that returns the variables to you. - Auto populate the flashvar with a serverside language: php, cf, jsp... etc - If you're using Flex, look into BrowserManager. Cheers, Nate On Tue, Dec 16, 2008 at 8:12 AM, Ali Drongo alidro...@googlemail.com wrote: Hi there, I'm passing a variable to my swf through a query string like this: htp://www.mydomain.com/index.html?passedPage=180 I have my main AS2 class that is the root class and have tried to access the variable like this: trace(PASSPAGE SET:+this[passedPage]); trace(PASSPAGE SET:+_level0.passedPage); trace(PASSPAGE SET:+_root.passedPage); each of these traces returns undefined. I am compiling this SWF using MTASC which means I can't write the var as passedPage as MTASC says this is an unknown variable. I have tried declaring passedPage as a public variable within the class though I still can't access it. Any suggestions much appreciated. Thanks Ali ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] How to access var passed in URL from AS2 class
No problem.. SWF Object is a GREAT way to embed your flash movies into HTML (or whatever).. It allows for a lot for other stuff as well.. -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Nate Beck Sent: Tuesday, December 16, 2008 11:17 AM To: Flash Coders List Subject: Re: [Flashcoders] How to access var passed in URL from AS2 class Hey that's cool, I didn't know that existed. Thanks whispers! -- Cheers, Nate http://blog.natebeck.net On Tue, Dec 16, 2008 at 9:08 AM, whispers whispers...@hotmail.com wrote: You can also use SWF Object to embed the movie... I believe you have the options or grabbing vars form the query string. Makes it quite easy: The SWFObject script also comes with an extra function which allows you to pull variable values from the url string. An example is you have a url that looks like this: http://www.example.com/page.html?variable1=value1variable2=value2. Using the function getQueryParamValue() you can easily pull these values from the url and then pass them into your Flash movie. Here is an example, we'll assume that the url looks like the above example: script type=text/javascript var so = new SWFObject(movie.swf, mymovie, 400, 200, 8, #336699); so.addVariable(variable1, getQueryParamValue(variable1)); so.addVariable(variable2, getQueryParamValue(variable2)); so.write(flashcontent); /script Take care -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Nate Beck Sent: Tuesday, December 16, 2008 10:35 AM To: Flash Coders List Subject: Re: [Flashcoders] How to access var passed in URL from AS2 class http://www.mydomain.com/index.html?passedPage=180 This won't pass into flash as a flashvar. You have a few options though. - Use Javascript to grab the query string and then write it in as a flashvar or query string to the swf. (ex: MySwf.swf?passedPage=180 - Make an ExternalInterface call a javascript function that returns the variables to you. - Auto populate the flashvar with a serverside language: php, cf, jsp... etc - If you're using Flex, look into BrowserManager. Cheers, Nate On Tue, Dec 16, 2008 at 8:12 AM, Ali Drongo alidro...@googlemail.com wrote: Hi there, I'm passing a variable to my swf through a query string like this: htp://www.mydomain.com/index.html?passedPage=180 I have my main AS2 class that is the root class and have tried to access the variable like this: trace(PASSPAGE SET:+this[passedPage]); trace(PASSPAGE SET:+_level0.passedPage); trace(PASSPAGE SET:+_root.passedPage); each of these traces returns undefined. I am compiling this SWF using MTASC which means I can't write the var as passedPage as MTASC says this is an unknown variable. I have tried declaring passedPage as a public variable within the class though I still can't access it. Any suggestions much appreciated. Thanks Ali ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] problem with loadMovie
Have you tried tracing out: _root[clicked_Button] And see what it returns to ensure that it is correctly giving you the data you need? -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Alexander Böhm Sent: Tuesday, December 16, 2008 8:14 AM To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] problem with loadMovie Hi there, can anybody tell me why the second line of code given here, loads the image perfectly into the holder-clip, and the other method won't work? ActionScript Code: _root[clicked_Button].picholder_mc.loadMovie(getPlayerInfo(surname, _root[this._name].name_txt.text).toLowerCase() + _set.png); _root[def_btn_4].picholder_mc.loadMovie(getPlayerInfo(surname, _root[this._name].name_txt.text).toLowerCase() + _set.png); the variable clicked_Button is a String-Variable and stores the instance-name of the movieclip pressed, e.g. def_btn_4 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Timer (AS3 newbie question)
Hi, You can still make a component to do this. I would recommend extending the Sprite / MovieClip class as your custom component. Add a variable called speed and add an Enter Frame handler to your code, then in there, work out your next position based on the speed. It would be a nice way of getting to grips with extending classes and using event listeners too.. Glen Mendelsohn, Michael wrote: In AS2, I would have made a component with a parameter for speed. I'm just not sure how to do that in AS3, so I was guessing with a timer, I could add and event listerner to dispatch an event to the target, but I guess not. Thanks! - MM -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Cor Sent: Tuesday, December 16, 2008 11:49 AM To: 'Flash Coders List' Subject: RE: [Flashcoders] Timer (AS3 newbie question) Why use a timer? It is not necessary to do it on exact time because you use a random. So in this case Event.ENTER_FRAME would do the trick for you. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Glen Pike 01326 218440 www.glenpike.co.uk http://www.glenpike.co.uk ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] referencing sprites within a sprite (AS3 newbie question)
Wow, AS3 is different, even after reading Moock's book. I'm sure this is an easy question: How do you reference sprites within a sprite in an event listener? I have a child allcolumns within a sprite. Within allcolumns are 50 columns (sprites), each named column1, column2, etc. Allcolumns has an event listener: private function changeChar(e:Event):void { e.target[column10].gotoAndStop(5); } Result: ReferenceError: Error #1069: Property column10 not found on flash.display.Sprite and there is no default value. How to drill into what's in the e.target? Thanks, - Michael M. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] referencing sprites within a sprite (AS3 newbie question)
Hey Michael, seeing as you can't create Sprites on the timeline, the following won't work because your sprites don't have instance names. Thus when you are creating your sprites, you have to add them all to an array. i.e. var columns:Array = new Array(); for(var i:int = 0; i = 50; i ++){ var column:Sprite = new Sprite(); allcolumns.addChild(column); columns.push(column); } private function changeChar(e:Event):void { columns[9].gotoAndStop(5); } On Tue, Dec 16, 2008 at 11:59 AM, Mendelsohn, Michael michael.mendels...@fmglobal.com wrote: Wow, AS3 is different, even after reading Moock's book. I'm sure this is an easy question: How do you reference sprites within a sprite in an event listener? I have a child allcolumns within a sprite. Within allcolumns are 50 columns (sprites), each named column1, column2, etc. Allcolumns has an event listener: private function changeChar(e:Event):void { e.target[column10].gotoAndStop(5); } Result: ReferenceError: Error #1069: Property column10 not found on flash.display.Sprite and there is no default value. How to drill into what's in the e.target? Thanks, - Michael M. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] referencing sprites within a sprite (AS3 newbie question)
If each of the columns has .name='column1' etc: e.target.getChildByName(column10).gotoAndStop(5); should do it. But personally I'd at least do some type-checking on all that, and would probably create a method inside an AllColumns class to handle changeChar(). (Obviously I don't know what you're doing, though...) Ian On Tue, Dec 16, 2008 at 7:59 PM, Mendelsohn, Michael michael.mendels...@fmglobal.com wrote: Wow, AS3 is different, even after reading Moock's book. I'm sure this is an easy question: How do you reference sprites within a sprite in an event listener? I have a child allcolumns within a sprite. Within allcolumns are 50 columns (sprites), each named column1, column2, etc. Allcolumns has an event listener: private function changeChar(e:Event):void { e.target[column10].gotoAndStop(5); } Result: ReferenceError: Error #1069: Property column10 not found on flash.display.Sprite and there is no default value. How to drill into what's in the e.target? Thanks, - Michael M. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] referencing sprites within a sprite (AS3 newbie question)
isn't getting a child by name very slow? Ian Thomas wrote: If each of the columns has .name='column1' etc: e.target.getChildByName(column10).gotoAndStop(5); should do it. But personally I'd at least do some type-checking on all that, and would probably create a method inside an AllColumns class to handle changeChar(). (Obviously I don't know what you're doing, though...) Ian On Tue, Dec 16, 2008 at 7:59 PM, Mendelsohn, Michael michael.mendels...@fmglobal.com wrote: Wow, AS3 is different, even after reading Moock's book. I'm sure this is an easy question: How do you reference sprites within a sprite in an event listener? I have a child allcolumns within a sprite. Within allcolumns are 50 columns (sprites), each named column1, column2, etc. Allcolumns has an event listener: private function changeChar(e:Event):void { e.target[column10].gotoAndStop(5); } Result: ReferenceError: Error #1069: Property column10 not found on flash.display.Sprite and there is no default value. How to drill into what's in the e.target? Thanks, - Michael M. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] referencing sprites within a sprite (AS3 newbiequestion)
Thanks Ian. That's the method I'm looking for, but can it work two levels deep? I'm really looking to change one MovieClip within each of these columns. Here's the code: private function changeChar(e:Event):void { var newFrame:uint = Math.random()*50; var whichColumn:uint = Math.round(Math.random()*50); var column:Sprite = Sprite(e.target).getChildByName(String(column + whichColumn)); var ec:MovieClip = column.getChildByName(endChar); ec.gotoAndStop(newFrame); } - MM If each of the columns has .name='column1' etc: e.target.getChildByName(column10).gotoAndStop(5); should do it. But personally I'd at least do some type-checking on all that, and would probably create a method inside an AllColumns class to handle changeChar(). (Obviously I don't know what you're doing, though...) ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] referencing sprites within a sprite (AS3 newbie question)
.currentTarget ? On Tue, Dec 16, 2008 at 4:51 PM, Ian Thomas i...@eirias.net wrote: Yes. However, it was the simplest answer to Michael's question. I'm afraid I didn't (and still don't) have time to answer the question with a long 'here's how I'd actually do it and why it's a good idea not to refer to nested clips like this' email, unfortunately. :-) It was a quick fix for Michael, and in the long term, you're right - the wrong answer. Perhaps I shouldn't comment at all when I'm this short of time. :-) But feel free to write your own answer, Anthony... Ian On Tue, Dec 16, 2008 at 9:08 PM, Anthony Pace anthony.p...@utoronto.ca wrote: isn't getting a child by name very slow? Ian Thomas wrote: If each of the columns has .name='column1' etc: e.target.getChildByName(column10).gotoAndStop(5); should do it. But personally I'd at least do some type-checking on all that, and would probably create a method inside an AllColumns class to handle changeChar(). (Obviously I don't know what you're doing, though...) Ian On Tue, Dec 16, 2008 at 7:59 PM, Mendelsohn, Michael michael.mendels...@fmglobal.com wrote: Wow, AS3 is different, even after reading Moock's book. I'm sure this is an easy question: How do you reference sprites within a sprite in an event listener? I have a child allcolumns within a sprite. Within allcolumns are 50 columns (sprites), each named column1, column2, etc. Allcolumns has an event listener: private function changeChar(e:Event):void { e.target[column10].gotoAndStop(5); } Result: ReferenceError: Error #1069: Property column10 not found on flash.display.Sprite and there is no default value. How to drill into what's in the e.target? Thanks, - Michael M. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- http://ericd.net Interactive design and development ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] referencing sprites within a sprite (AS3 newbie question)
So as a general question, what is the preferred method if you're trying to get, say, dynamically generated children, eg image1image20 etc, from a container? .m On Tue, Dec 16, 2008 at 4:51 PM, Ian Thomas i...@eirias.net wrote: Yes. On Tue, Dec 16, 2008 at 9:08 PM, Anthony Pace anthony.p...@utoronto.ca wrote: isn't getting a child by name very slow? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] referencing sprites within a sprite (AS3 newbie question)
I use the method I gave you earlier, adding elements to an array and accessing them that way. Also, you can use getChildAt() if you know the index of the children, which it sounds like you do if you have them named as you do... i.e. column1, column2, column3 On Tue, Dec 16, 2008 at 2:17 PM, Matt S. mattsp...@gmail.com wrote: So as a general question, what is the preferred method if you're trying to get, say, dynamically generated children, eg image1image20 etc, from a container? .m On Tue, Dec 16, 2008 at 4:51 PM, Ian Thomas i...@eirias.net wrote: Yes. On Tue, Dec 16, 2008 at 9:08 PM, Anthony Pace anthony.p...@utoronto.ca wrote: isn't getting a child by name very slow? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] referencing sprites within a sprite (AS3 newbie question)
On Tue, Dec 16, 2008 at 10:57 PM, Taka Kojima t...@gigafied.com wrote: I use the method I gave you earlier, adding elements to an array and accessing them that way. As do I. Ian ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Timer (AS3 newbie question)
I'd say look into TweenLite, it supports tween delay and tween length which I think would solve your problem and also wouldn't entail having to deal with a bunch of ENTER_FRAME event listeners. - Taka On Tue, Dec 16, 2008 at 10:20 AM, Glen Pike postmas...@glenpike.co.ukwrote: Hi, You can still make a component to do this. I would recommend extending the Sprite / MovieClip class as your custom component. Add a variable called speed and add an Enter Frame handler to your code, then in there, work out your next position based on the speed. It would be a nice way of getting to grips with extending classes and using event listeners too.. Glen Mendelsohn, Michael wrote: In AS2, I would have made a component with a parameter for speed. I'm just not sure how to do that in AS3, so I was guessing with a timer, I could add and event listerner to dispatch an event to the target, but I guess not. Thanks! - MM -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Cor Sent: Tuesday, December 16, 2008 11:49 AM To: 'Flash Coders List' Subject: RE: [Flashcoders] Timer (AS3 newbie question) Why use a timer? It is not necessary to do it on exact time because you use a random. So in this case Event.ENTER_FRAME would do the trick for you. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Glen Pike 01326 218440 www.glenpike.co.uk http://www.glenpike.co.uk ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Re: A funny little hover problem with CSS
Wow. Thanks. I wouldn't have thought rotating a text field would make it better. Whenever I need to rotate text I usually render it to a bitmap and rotate that. Help is much appreciated. Ashim 2008/12/17 Jon Bradley jbrad...@postcentral.com On Dec 14, 2008, at 8:04 PM, Ashim D'Silva wrote: Right. I recreated everything slowly in a new file, introducing things one by one and here's the culprit - Advanced Anti-Aliasing.Now I really would like to use advanced, because text looks dramatically better, but there has to be a solution, doesn't there? The issue affects more than just static fields (with hovers). It dramatically affects applications where users are allowed to rotate and scale dynamic text fields. In that instance, the kerning, leading and character positions are offset and randomly jump around in value. The kerning is the worst - as a field is scaled the kerning will jump anywhere between 0-2 em on the characters ... randomly between each. The only work around is to have the text field rotated by a small amount (0.01, for example). I submitted this bug to Adobe quite while back, along with the 'workaround.' Sorry to be the bearer of bad news. At least you can give the rotation of the field a shot. You may need to use AS to set the rotation via a Matrix. var m:Matrix = new Matrix(); m.rotate(0.01); myTextfield.transform = m; The rotaion might need to be tweaked a tad - I don't have my bug app open right now to check out the exact value that I ended up using. - jon ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- The Random Lines My online portfolio www.therandomlines.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Re: A funny little hover problem with CSS
I think I know the solution It's quite a different approach... but a lot of times text has shifting problems on hovers and whatnot when their x,y's are not set at exact pixels. Maybe try changing the positioning on the stage so that the elements use an exact x,y value, or do a Math.round() if you're positioning them through AS. Hope this helps. -Taka On Tue, Dec 16, 2008 at 4:05 PM, Ashim D'Silva as...@therandomlines.comwrote: Wow. Thanks. I wouldn't have thought rotating a text field would make it better. Whenever I need to rotate text I usually render it to a bitmap and rotate that. Help is much appreciated. Ashim 2008/12/17 Jon Bradley jbrad...@postcentral.com On Dec 14, 2008, at 8:04 PM, Ashim D'Silva wrote: Right. I recreated everything slowly in a new file, introducing things one by one and here's the culprit - Advanced Anti-Aliasing.Now I really would like to use advanced, because text looks dramatically better, but there has to be a solution, doesn't there? The issue affects more than just static fields (with hovers). It dramatically affects applications where users are allowed to rotate and scale dynamic text fields. In that instance, the kerning, leading and character positions are offset and randomly jump around in value. The kerning is the worst - as a field is scaled the kerning will jump anywhere between 0-2 em on the characters ... randomly between each. The only work around is to have the text field rotated by a small amount (0.01, for example). I submitted this bug to Adobe quite while back, along with the 'workaround.' Sorry to be the bearer of bad news. At least you can give the rotation of the field a shot. You may need to use AS to set the rotation via a Matrix. var m:Matrix = new Matrix(); m.rotate(0.01); myTextfield.transform = m; The rotaion might need to be tweaked a tad - I don't have my bug app open right now to check out the exact value that I ended up using. - jon ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- The Random Lines My online portfolio www.therandomlines.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Re: A funny little hover problem with CSS
p.s. make sure all of the textfield's parents also have their x,y values as whole pixels. -Taka On Tue, Dec 16, 2008 at 4:18 PM, Taka Kojima t...@gigafied.com wrote: I think I know the solution It's quite a different approach... but a lot of times text has shifting problems on hovers and whatnot when their x,y's are not set at exact pixels. Maybe try changing the positioning on the stage so that the elements use an exact x,y value, or do a Math.round() if you're positioning them through AS. Hope this helps. -Taka On Tue, Dec 16, 2008 at 4:05 PM, Ashim D'Silva as...@therandomlines.comwrote: Wow. Thanks. I wouldn't have thought rotating a text field would make it better. Whenever I need to rotate text I usually render it to a bitmap and rotate that. Help is much appreciated. Ashim 2008/12/17 Jon Bradley jbrad...@postcentral.com On Dec 14, 2008, at 8:04 PM, Ashim D'Silva wrote: Right. I recreated everything slowly in a new file, introducing things one by one and here's the culprit - Advanced Anti-Aliasing.Now I really would like to use advanced, because text looks dramatically better, but there has to be a solution, doesn't there? The issue affects more than just static fields (with hovers). It dramatically affects applications where users are allowed to rotate and scale dynamic text fields. In that instance, the kerning, leading and character positions are offset and randomly jump around in value. The kerning is the worst - as a field is scaled the kerning will jump anywhere between 0-2 em on the characters ... randomly between each. The only work around is to have the text field rotated by a small amount (0.01, for example). I submitted this bug to Adobe quite while back, along with the 'workaround.' Sorry to be the bearer of bad news. At least you can give the rotation of the field a shot. You may need to use AS to set the rotation via a Matrix. var m:Matrix = new Matrix(); m.rotate(0.01); myTextfield.transform = m; The rotaion might need to be tweaked a tad - I don't have my bug app open right now to check out the exact value that I ended up using. - jon ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- The Random Lines My online portfolio www.therandomlines.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] inversedMask method stopping any parent masks?
Sorry I think the URL to the original method and subsequent posts about my problem was alittle messed up.. appreciate it if ANYONE could get this working..or at leasttell me its not even possible in Flash. Thanks correct url: http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15catid=288threadid=1412793enterthread=y - Original Message - From: whispers To: flashcoders@chattyfig.figleaf.com Sent: Monday, December 15, 2008 11:40 AM Subject: [Flashcoders] inversedMask method stopping any parent masks? Hi this is my first post, so I hope I'm doing this correctly..LOL This is AS2, not AS3, so if anyone could suggest something to search for I'd appreciate it. I am trying to use this method here: (found on Adobes forms) http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15 http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15cat id=288threadid=1410897CFID=13151180CFTOKEN=5df21005bb1feb31-2CD5FFB4-F67E -56DC-E1E8B1280EE0B55Cjsessionid=4830966da44a4398c212f6359546a572e3e3 catid=288threadid=1410897CFID=13151180CFTOKEN=5df21005bb1feb31-2CD5FFB4- F67E-56DC-E1E8B1280EE0B55Cjsessionid=4830966da44a4398c212f6359546a572e3e3 to create an inversed mask of the shape I have drawn (lineTo) inside a movieClip.. my clip layout/nesting is as follows: parent.parent clip (contentContainer) | ---parent clip (faceContainer) | lineContainer (holds the shape/object I'm using for my source of the inverse mask maskContainer (empty clip to hold the dynamically created clip from the inverse mask method above) imageContainer (the place where the dynamically loaded image gets loaded into, and is 'masked' by the inversedMask method) now this all works fine.. except I want to add a mask to the parent clip thats holding these 3 nested clips...(faceContainer).. or even to the parent clip of that (contentContainer).. but when I do so.. and then invoke the inversedMask() method from above,...the whole imageContainer goes blank... now since the only REAL masking is the maskContainer, masking the imageContainer.. why cant I add a mask manually or through AS to the faceContainer or the contentContainer clips? I cant seem to figure it out... something with this inversedMethod() I've found and am using?..or just an illegal (I don't believe so) application of masks in Flash? any ideas or suggestion is helpful.. this 'IS' AS2 by the way... (just to re-iterate) thanks for the eyes. =) -xl97 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] referencing sprites within a sprite (AS3 newbie question)
Yes. However, it was the simplest answer to Michael's question. I'm afraid I didn't (and still don't) have time to answer the question with a long 'here's how I'd actually do it and why it's a good idea not to refer to nested clips like this' email, unfortunately. :-) It was a quick fix for Michael, and in the long term, you're right - the wrong answer. Perhaps I shouldn't comment at all when I'm this short of time. :-) But feel free to write your own answer, Anthony... Ian On Tue, Dec 16, 2008 at 9:08 PM, Anthony Pace anthony.p...@utoronto.ca wrote: isn't getting a child by name very slow? Ian Thomas wrote: If each of the columns has .name='column1' etc: e.target.getChildByName(column10).gotoAndStop(5); should do it. But personally I'd at least do some type-checking on all that, and would probably create a method inside an AllColumns class to handle changeChar(). (Obviously I don't know what you're doing, though...) Ian On Tue, Dec 16, 2008 at 7:59 PM, Mendelsohn, Michael michael.mendels...@fmglobal.com wrote: Wow, AS3 is different, even after reading Moock's book. I'm sure this is an easy question: How do you reference sprites within a sprite in an event listener? I have a child allcolumns within a sprite. Within allcolumns are 50 columns (sprites), each named column1, column2, etc. Allcolumns has an event listener: private function changeChar(e:Event):void { e.target[column10].gotoAndStop(5); } Result: ReferenceError: Error #1069: Property column10 not found on flash.display.Sprite and there is no default value. How to drill into what's in the e.target? Thanks, - Michael M. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] referencing sprites within a sprite (AS3 newbie question)
I wasnt actually the original question-asker, but thanks :) I was just curious about the actual performance hit from getChild. .m On Tue, Dec 16, 2008 at 5:57 PM, Taka Kojima t...@gigafied.com wrote: I use the method I gave you earlier, adding elements to an array and accessing them that way. Also, you can use getChildAt() if you know the index of the children, which it sounds like you do if you have them named as you do... i.e. column1, column2, column3 On Tue, Dec 16, 2008 at 2:17 PM, Matt S. mattsp...@gmail.com wrote: So as a general question, what is the preferred method if you're trying to get, say, dynamically generated children, eg image1image20 etc, from a container? .m On Tue, Dec 16, 2008 at 4:51 PM, Ian Thomas i...@eirias.net wrote: Yes. On Tue, Dec 16, 2008 at 9:08 PM, Anthony Pace anthony.p...@utoronto.ca wrote: isn't getting a child by name very slow? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Re: A funny little hover problem with CSS
I always round everything I place. That was one of the first things I checked. Rotated bitmaps and text often have this problem, which is fair enough because half pixels don't exist. Cheers though. 2008/12/17 Taka Kojima t...@gigafied.com p.s. make sure all of the textfield's parents also have their x,y values as whole pixels. -Taka On Tue, Dec 16, 2008 at 4:18 PM, Taka Kojima t...@gigafied.com wrote: I think I know the solution It's quite a different approach... but a lot of times text has shifting problems on hovers and whatnot when their x,y's are not set at exact pixels. Maybe try changing the positioning on the stage so that the elements use an exact x,y value, or do a Math.round() if you're positioning them through AS. Hope this helps. -Taka On Tue, Dec 16, 2008 at 4:05 PM, Ashim D'Silva as...@therandomlines.com wrote: Wow. Thanks. I wouldn't have thought rotating a text field would make it better. Whenever I need to rotate text I usually render it to a bitmap and rotate that. Help is much appreciated. Ashim 2008/12/17 Jon Bradley jbrad...@postcentral.com On Dec 14, 2008, at 8:04 PM, Ashim D'Silva wrote: Right. I recreated everything slowly in a new file, introducing things one by one and here's the culprit - Advanced Anti-Aliasing.Now I really would like to use advanced, because text looks dramatically better, but there has to be a solution, doesn't there? The issue affects more than just static fields (with hovers). It dramatically affects applications where users are allowed to rotate and scale dynamic text fields. In that instance, the kerning, leading and character positions are offset and randomly jump around in value. The kerning is the worst - as a field is scaled the kerning will jump anywhere between 0-2 em on the characters ... randomly between each. The only work around is to have the text field rotated by a small amount (0.01, for example). I submitted this bug to Adobe quite while back, along with the 'workaround.' Sorry to be the bearer of bad news. At least you can give the rotation of the field a shot. You may need to use AS to set the rotation via a Matrix. var m:Matrix = new Matrix(); m.rotate(0.01); myTextfield.transform = m; The rotaion might need to be tweaked a tad - I don't have my bug app open right now to check out the exact value that I ended up using. - jon ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- The Random Lines My online portfolio www.therandomlines.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- The Random Lines My online portfolio www.therandomlines.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders