OZONE Asylum
Forums
Multimedia/Animation
erm... attachMovie in class constructors?
This page's ID:
11466
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
PT - just for the sake of clarity in other posts - are you currently using MX 2004? If no, there are some big problems in this code. (MX doesn't have a "class" keyword, and isn't strongly typed to give two examples of what I mean.) If so, I don't know how helpful I can be in the short term future, not having it myself. If the goal of the class GameStage is to place a bunch of clips on stage and move them around, the snippet you showed looks strangely rigid, but I suppose it was just an early test to get attachMovie working from inside a function. two thought; - use "this", and "with" cuts down some on typing: [code] function GameStage() { graphic_mc = attachMovie("graphic_library_name", "instance_name", 10); graphic_mc._x = 100; graphic_mc._y = 100; graphic_mc._visible = true; }[/code] might become: [code] function GameStage() { this.graphic_mc = _level0.attachMovie(args); with (this.graphic_mc){ _x = 100; _y = 100; _visible = true; } }[/code] (_level0 and _root are essentially the same thing. Another handy trick is to put near the beginning of the first frame of the main timeline a persistant reference to _root: [code]_global.mainTL = this;[/code] You have added a property ("mainTL") to the _global variable, and that property points to _root. Now you can reference _root anywhere, anytime by calling mainTL (or whatever you choose to call it.)
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »