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
quest1is a reference toapp.questionmark1which you are adding toFrameCanvas.baseCanvasand 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 exampleapp.questionmark1may 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.questionmark1asquest1as you already can access it byapp.questionmark1.