Thanks, guys. beno On Wed, Nov 18, 2009 at 11:32 AM, Zeh Fernando <z...@zehfernando.com> wrote:
> http://livedocs.adobe.com/flex/2/langref/migration.html > > On Wed, Nov 18, 2009 at 10:20 AM, beno - <flashmeb...@gmail.com> wrote: > > > Hi; > > I've found the following AS2 script I'm trying to translate into AS3. > Right > > now, I'd just like a little help understanding how to rewrite some code > > variables. Please help me translate into AS3 (with my guesses ;) > > > > _xmouse (mouseX?) > > _root (root?) > > > > Just for good style, should I eliminate all the leading underscores, or > is > > this used for keeping the variables private (like in python)? > > > > Also, is there a good online doc for translation from AS2 to AS3? > > BTW, I assume the "Flash IDE (integrated dev. env.)" means the GUI, as > > opposed to coding directly? > > TIA, > > beno > > > > > > /** > > * Animated Explosion Effect > > * > > * Version: 1.0 > > * Author: Philip Radvan > > * URL: http://www.freeactionscript.com > > */ > > > > //Settings > > var explosionParticleAmount:Number = 15; > > var explosionDistance:Number = 30; > > var explosionSize:Number = 100; > > var explosionAlpha:Number = 75; > > > > function addExplosion(targetX:Number, targetY:Number, > > _explosionParticleAmount:Number, _distance:Number, _explosionSize:Number, > > _explosionAlpha:Number):Void > > { > > //run a for loop based on the amount of explosion particles > > for(var i = 0; i < _explosionParticleAmount; i++) > > { > > //create particle > > var _tempClip2 = _root.attachMovie("explosion2", "explosion2_" + > > _root.getNextHighestDepth(), _root.getNextHighestDepth()); > > var _tempClip = _root.attachMovie("explosion", "explosion" + > > _root.getNextHighestDepth(), _root.getNextHighestDepth()); > > //set particle position > > _tempClip.x = targetX+random(_distance)-(_distance/2); > > _tempClip.y = targetY+random(_distance)-(_distance/2); > > _tempClip2.x = targetX+random(_distance)-(_distance/2); > > _tempClip2.y = targetY+random(_distance)-(_distance/2); > > > > //get random particle scale > > var tempRandomSize = random(_explosionSize)+_explosionSize/2; > > //set particle scale > > _tempClip.scaleX = tempRandomSize; > > _tempClip.scaleY = tempRandomSize; > > //get random particle scale > > var tempRandomSize = random(_explosionSize)+_explosionSize/2; > > //set particle scale > > _tempClip2.scaleX = tempRandomSize; > > _tempClip2.scaleY = tempRandomSize; > > > > //set particle rotation > > _tempClip2._rotation = random(359); > > > > //set particle alpha > > _tempClip.alpha = random(explosionAlpha)+explosionAlpha/4; > > _tempClip2.alpha = random(explosionAlpha)+explosionAlpha/4; > > } > > } > > > > /** > > * > > * Mouse Controls > > * > > */ > > //create an object that we'll listen to > > mouseListener = new Object(); > > > > //on Click, create explosionle > > mouseListener.addEventListener(mouseEvent.onMouseDown, doThis); > > functioin doThis():void > > { > > addExplosion(_xmouse, _ymouse, explosionParticleAmount, > > explosionDistance, explosionSize, explosionAlpha); > > }; > > > > //add listener > > Mouse.addListener(mouseListener); > > _______________________________________________ > > 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