-
[F8] Adding button behavior on the fly
Hi all,
Can anyone suggest the best way to approach the following?
I currently am trying to load an array of movieclips (one on top of the other):
Code:
createEmptyMovieClip("content_holder_mc", this.getNextHighestDepth());
content_holder_mc._x = 21
content_holder_mc._y = 121
for (var i = 0; i<return_query.length; i++) {
content_holder_mc.attachMovie("blueMovie", "blue"+i, content_holder_mc.getNextHighestDepth(), {_y:content_holder_mc._height+5, _x:5+i});
}
This all works fine however is there away of adding an onRelease method to the newly attached movieclips rather than adding the code inside the movieclip itself?
Cheers
!.....................................COMING SOON
-
All 1s and 0s
Hi,
There ceratainly is. When you use 'attachMovie', Flash returns a reference to the clip so that you can assign things to it:
code:
var newClip:MovieClip = content_holder_mc.attachMovie("blueMovie", "blue"+i, content_holder_mc.getNextHighestDepth(), {_y:content_holder_mc._height+5, _x:5+i});
newClip.onRelease = function() {
//your code here
}
Hope this helps.
"If I have seen further, it is by standing on the shoulders of giants." - Sir Isaac Newton
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
|