Hello!
Here is my questions:
I have this Document Class:
Code:
package
{
import flash.display.MovieClip;
/**
* ...
* @author infidel - aka Ovidiu Gheorghe
*/
public class main extends MovieClip
{
public var bg_mc:MovieClip = new MovieClip();
public var redSquare_mc:redSquare = new redSquare();
public var blueSquare_mc:blueSquare = new blueSquare(this);
public var greenSquare_mc:greenSquare = new greenSquare();
public function main()
{
composeScene();
//getAlpha(blueSquare_mc);
}
private function getAlpha(nume:Object):void
{
//bg_mc.alpha = .2;
trace("alpha: " + nume.alpha);
}
private function composeScene():void
{
this.addChild(bg_mc);
this.bg_mc.addChild(redSquare_mc);
this.bg_mc.addChild(blueSquare_mc);
blueSquare_mc.x = stage.stageWidth / 2;
blueSquare_mc.y = stage.stageHeight / 2;
redSquare_mc.addChild(greenSquare_mc);
greenSquare_mc.x += 150;
greenSquare_mc.y += 150;
}
}
}
and a separate class called blueSquare.as attached to blueSquare movieclip in library:
Code:
package
{
import flash.display.MovieClip;
/**
* ...
* @author infidel - aka Ovidiu Gheorghe
*/
public class blueSquare extends MovieClip
{
public var myPath:Object;
public function blueSquare(passedPath:Object)
{
myPath = passedPath;
// trace1:
trace(myPath.name);
// trace2:
trace(myPath.redSquare_mc.alpha);
// trace3:
trace(myPath.bg_mc.redSquare_mc.alpha);
}
}
}
Questions:
-
howcome that in my document class I can set the x, y for the greenSquare directly, without “this.redSquare_mc.greenSquare_mc” in front ?
-
howcome I get an error in my blueSquare.as class when I trace:
Code:
trace(myPath.bg_mc.redSquare_mc.alpha);
Yes, I know I come from a strong as2 way of thinking!
Tnx a bunch guys,
Ovidiu