Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



ActionScript 3 beginner having problem

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 18-11-2009
Member
 
Join Date: Nov 2009
Posts: 37
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);

Reply With Quote
  #2  
Old 18-11-2009
Member
 
Join Date: Oct 2005
Posts: 2,389
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?
Reply With Quote
  #3  
Old 18-11-2009
Member
 
Join Date: Nov 2009
Posts: 37
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.
Reply With Quote
  #4  
Old 18-11-2009
Member
 
Join Date: Oct 2005
Posts: 2,389
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)
Reply With Quote
  #5  
Old 18-11-2009
Member
 
Join Date: Nov 2009
Posts: 37
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
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "ActionScript 3 beginner having problem"
Thread Thread Starter Forum Replies Last Post
How to convert Actionscript 2 to actionscript 3 Bol-Bacchan Software Development 4 17-01-2011 06:59 AM
Is it possible to write ActionScript 2 in Adobe CS5 B-JOB Guru Windows Software 3 16-01-2011 05:09 AM
Want to learn ActionScript.....What to Refer? Andrzej Software Development 3 14-11-2009 11:12 AM
ActionScript in Flash CS3 Manthan Software Development 4 08-07-2009 10:18 PM
Actionscript 3 Compiler ? Xavier1234 Software Development 3 29-06-2009 05:09 PM


All times are GMT +5.5. The time now is 05:32 PM.