This content has been marked as final. Show 6 replies
What is the code that is failing and how are you attaching the button?
Put the code up here and I'll have a look. Cant promise I will solve it though :)
Here is the code which is placed on a movieclip nested inside the movieclip I use for the attachMovieclip instances. Again the first instance works fine but the subesequent instances do not execute this code.
I have had a play around and it is not working at all for me.
What exactly are you wanting to happen to each instance when the keys are pressed, should they move individually or all together as one?
If you can describe the finished thing I can probably get it working.
Thnaks for helping me out Pop.
I'm trying to make a time grid display consisting of vertical lines which can be panned and zoomed. To accomplish this I'm attaching individual vertical lines, each as an individual movieclip. The code I posted has to be attached to an object instance so I nested an instance of a vertical line MC inside another to make a parent movieclip which I can attach or remove at runtime.
I'm probably going about this wrong, so I'd be happy with any approach which achieves the end result... - a zoomable/scrollable time grid display.
> The code I posted has to be attached to an object
> instance so I nested an instance of a vertical line
> MC inside another to make a parent movieclip
> which I can attach or remove at runtime.
Actually, you don't have to attach that code directly to the object (in
fact, that's been "bad form" since Flash MX, though on() and onClipEvent()
still work fine). I tried to duplicate your issue and was able to ... and
frankly, I can't imagine why each separate instance wouldn't follow through.
First, I thought it might be an issue of focus, but I switched focus back
and forth among the movie clips (by tabbing) and that didn't seem to fix the
problem. It might actually *be* a focus issue, but additional testing would
take more time, and today is a bit tight for me.
Check out your other options, for sure. Since Flash MX, it's been
possible to assign event handlers from keyframe scripts. That way, you can
attach your movie clips (nested or not) and refer to them by the unique
instance name you give each one as you attach.
Adobe Community Expert
Dev blog, http://www.quip.net/blog/
"Luck is the residue of good design."
Thanks all. I am now using an event handler from a keyframe script and have made some good progress (panning works... although zooming is proving much harder...;)
David, I found your comments (and related bloggings) very useful, much of it under the category "wish I had have known that earlier". I agree, for the most part, it makes more sense to code event handlers from a keyframe rather than attached to individual object instances.
Initially I guess I was trying to use a more object oriented coding approach where the event handling was a 'method' of the object. My real problem is I couldn't (and still can't) understand how to attach the event handling code to the symbol itself (object class?) and not a specific instance. You know for example a "ball" symbol might have a bounce method - it seems somewhat natural (OOP perhaps?) to want to attach the event handling for 'bounce' to the "ball" symbol or class.
I am also currently thinking actionscript has evolved at an extreme level over the past several years resulting in many many pieces of deprecated, or at least less than efficient code snippets, tutorials, postings, samples, etc.