View Full Version : AS 3 library class links and clips within the linked object?
creatify
11-24-2006, 09:51 PM
I've found several threads on the MOUSE_UP "problem" with AS3 where onReleaseOutside, in its AS2 form, doesn't work. The solution being to add a MOUSE_UP event to the Stage.
Question is, if I have a slide-bar class, a simple dragger, its it happens to be added to a movieclip thats in another movieclip etc, do I have to adjust my class continually so that I use: this.parent.parent.parent etc. to get to the Stage to set this listener? I can't just set it using Stage.addListener.
I think this looks cryptic - but to those that have run into this specific MOUSE_UP issue, I'm sure this will look familiar.
Thanks for any input in advance.
mathew.er
11-24-2006, 11:27 PM
You cant access Stage object diretly. You should use DisplayObject.stage property instead. It should be present in any Sprite or component you can find as all these classes inherit from DisplayObject
TheCanadian
11-24-2006, 11:43 PM
You should note that the the DisplayObject which you are using to reference Stage must be in the display list, otherwise its stage property will return null.
Krilnon
11-25-2006, 10:29 AM
I usually use the 'stage' property of my main class, that way I don't have to reference anything in front of it, and I can access it in the first line of the constructor. Also, it will always be on the display list, assuming you are using it as the main class.
creatify
11-25-2006, 01:11 PM
Thanks for the input - hmmm, maybe I will pass it through to the constructor of my main class which is instatiated on the first few frames of the timeline, then hand it down to any class instantiated within that class where I need to use it.
Thanks again everyone.
gpacioli
11-25-2006, 05:05 PM
I downloaded a library of classes (in a folder named AS3CBLibrary). Anyone want to tell me the .as code that will let me access thase library classes? My .as file is named sampleSprite.as --- it resides and sampleSprite.fls reside in a folder on my Mac desktop named sampleSprite. sampleSprite and AS3CBLibrary reside on my desktop.
gpacioli
11-25-2006, 05:07 PM
I think I might have gotten this in the wrong AS 3.0 thread --- I wish there were an ActionScript 3.0 forum.
mathew.er
11-25-2006, 06:58 PM
Check the classes and see in which package they belong to. Then put the into appropriate folders as package names. (e.g. if class belongs to com.somebody.somepackage package, then it has to be placed in place_where_is_your_code/com/somepackage/theFile.as)
If you want to use them in your code, then you will have to import them with the import packageName.className; statement. You also might need to change your class path to target location of these classes, if you dont want to include them directly in your project folder.
harishcoorg
07-18-2007, 04:55 AM
I am newbie to as3 please I need help from you guys.
I have downloaded the as3cbllibrary I have pasted it in class path and tried to call by var pen:Pen = new Pen(graphics); but I'm not getting it.
even tried with giving a custom class path...
please help me in this....
thanx in advance=)
Check the classes and see in which package they belong to. Then put the into appropriate folders as package names. (e.g. if class belongs to com.somebody.somepackage package, then it has to be placed in place_where_is_your_code/com/somepackage/theFile.as)
If you want to use them in your code, then you will have to import them with the import packageName.className; statement. You also might need to change your class path to target location of these classes, if you dont want to include them directly in your project folder.
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.