ActionScript 3 beginner having problem
I started in AS3 (ActionScript 3) and everything seems more complicated and time consuming to do in AS2 but I keep good. Can you help me how to start? Is there any problem in this little script
Code:
var sp:Sprite=new mc();
sp.name="sp1";
sp.life=100; // Error: Access to the property life can not be defined via a reference type static...
this.addChild(sp);
Re: ActionScript 3 beginner having problem
you already type your object into another, even if it is extended it is cleaner type in the class
var sp:Sprite = new Sprite();
var sp:mc = new mc();
well then you have property in your life object mc?
Re: ActionScript 3 beginner having problem
These 2 lines together does not work, only the 2nd password. How does it if the life and property is in my object mc? TM is a clip (actually a class with export for actionscript checked). In AS2 you could add in the script as variable they wanted to be attached when a clip on the stage, eg after a mc = attachMovie (....)
mc.life6;
mc.energy = 100;
etc. ... there was nothing else to do.
Re: ActionScript 3 beginner having problem
And yes but you must have now created an object or class
var obj:object = new Object()
obj.clip = new mc();
obj.energy = 100
addChild(obj.clip)
Re: ActionScript 3 beginner having problem
Well, AS3 messes up everything! Fun all these tips, I'll try it myself and document over because finally there's a lot more changes than I thought.
Actually it might work as AS2 is typing when that all happens.
Code:
var sp:mc=new mc(); //While with var sp:Sprite=new mc()...
addChild(sp);
sp.life=10; //... this line would not work