| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
the ever-living
|
So, how this code would be in AS3???
Please help me to understand, i can only understand with examples... origin = new Object(); origin.x = 150; origin.y = 150; focalLength = 300; figureA.x = -50; figureA.y = 0; figureA.z = 0; figureA.dir = 1; figureB.x = 0; figureB.y = 0; figureB.z = 250; figureB.dir = 1; figureC.x = 50; figureC.y = 0; figureC.z = 500; figureC.dir = 1; speed = 20; backAndForth = function(){ this.z += speed*this.dir; if (this.z > 500){ this.z = 500; this.dir = -1; }else if (this.z < 0){ this.z = 0; this.dir = 1; } var scaleRatio = focalLength/(focalLength + this.z); this._x = origin.x + this.x * scaleRatio; this._y = origin.y + this.y * scaleRatio; this._xscale = this._yscale = 100 * scaleRatio; this.swapDepths(-this.z); }; figureA.onEnterFrame = backAndForth; figureB.onEnterFrame = backAndForth; figureC.onEnterFrame = backAndForth; |
|
|
|
|
|
#2 |
|
lala
Join Date: Feb 2002
Location: on the road
Posts: 2,859
|
this is a very AS1 type example. you would be able to do this in as3, in a simmiliar way to which you have there, but because you are dynamically accessing and creating functions it will be slower than doing it the right way in AS3
there are a ton of blogs about that have examples of AS3 applications. |
|
|
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|