-
Confused about Classes
when you set the linkage for a movie clip, the base class is set for you, usually?
then how do you know what Class to set?
I made a rect on the stage. Converted it to mc.
Set linkage for as3 and it said it would set the class automatically.
No matter what I ask it to return
this was simply a trace for x
when I run it
1119: Access of possibly undefined property x through a reference with static type Class.
I know this is stupid but is there a clear tutorial on this somewhere?
If the base class is set, why set the other if the mc is not really doing anything...
cant find any as3 tuts on this to clear it up for me..
any help is welcome..
thanks
-
Senior Member
You convert something into movie clip. In the library it will have name "mymc". You set the linkage options and class is created for you automatically. The class name will be same as your name in the library. To show the movie clip on stage you write:
othermc:mymc=new mymc();
this.addChild(othermc);
Now new instance of mymc will be visible on stage. You can access its properties whenever you need:
othermc.x=100;
trace(othermc.x);
-
I cant get this to work from my class..
any additional help?
Last edited by mpalma; 07-01-2007 at 03:03 PM.
-
Page.as
Page.fla
movieClip in the Library named "Page" and linked to Page class
var nPage:Page = new Page()?
nPage.addChild(nPage);
nPage.x=100?
what am I doing wrong?
thanks in advance...
-
hippie hater
Originally Posted by mpalma
what am I doing wrong?
nPage.addChild(nPage);
-
Originally Posted by mpalma
Page.as
Page.fla
movieClip in the Library named "Page" and linked to Page class
var nPage:Page = new Page()?
nPage.addChild(nPage);
nPage.x=100?
what am I doing wrong?
thanks in advance...
sorry should have been
Page.fla
movieClip in the Library named "Page" and linked to Page class
(in the class .as)
var nPage:Page = new Page()?
this.addChild(nPage);
nPage.x=100?
-
var nPage:Page = new Page()
addChild(nPage);
nPage.x=100
if you put that code in the main document class, page will be attached to the route stage. to change where its attached, you use dot syntax, for example
pagelayer.addChild(nPage)
Wait are you the same person as the thread starter? or did you just hijack his thread.... .........
As for the thread STARTER, head over here to learn about classes
http://www.kirupa.com/forum/showthread.php?t=223798
and
http://www.adobe.com/devnet/actionsc..._excerpts.html
There are plenty of other tutorials on classes, but i only saved the links of those 2.
Last edited by Flyingcow; 07-01-2007 at 09:28 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|