I have 2 possibilities. It looks like these are the same (or I'm wrong). Which is better and why?
var quest1:DisplayObject = FrameCanvas.baseCanvas.addChild(app.questionmark1); //
quest1.x = posX; //
quest1.y = posY; //
or
app.questionmark1.x = posX;
app.questionmark1.y = posY;
In the first example quest1
is a reference to app.questionmark1
which you are adding to FrameCanvas.baseCanvas
and then updating its x and y.
In the second example you are directly setting the x and y on app.questionmark1.
Both work to update app.questionmark1
's x and y properties, but in the second example app.questionmark1
may not be on the stage unless you added it somewhere else in the code.
The second example is better because there's really not a reason to store a reference to app.questionmark1
as quest1
as you already can access it by app.questionmark1
.