buggy basic flash
- Started
- Last post
- 13 Responses
- Cenitgrade
hmmm, this is a simple one it think.... I'm using a listener to let flash know what image i'm on in SlideShow Pro. I simply want to highlight an external movie clip based on that. It traces out correct but doesn't work...
//NavColour
var sspNavColourListener = new Object();
sspNavColourListener.onImageData = function(eventObject):Void {
var colourButton:Number;
colourButton = eventObject.data.title;
trace("image title is "+colourButton);
var currentImage:String;
currentImage = "nav";
trace(currentImage+colourButton...
Tweener.addTween(currentImage+co... time:0, delay:.25, transition:"linear"});
}
fluid.gallery.addEventListener... sspNavColourListener);tracing this (currentImage+colourButton) results in nav01, nav02 etc... which is what I want as those are the instance names I want to target. But the tweener doesn't recognize it. However if I type in nav01 into the tweener bit, tweener does.
any thoughts?
- Cenitgrade0
the trace bit got messed up when I pasted the code... but the syntax is correct in the original file.
- Cenitgrade0
Thanks NONEIS
Yep I think I know what you mean. I kinda guessed I was sending a string. I'm using As2. So I tried this and it didn't work?
var colourButton:Number;
colourButton = eventObject.data.title;
var currentImage:String;
currentImage = ("nav"+colourButton);
Tweener.addTween(MovieClip(curre... time:0, delay:.25, transition:"linear"});
}
- Cenitgrade0
ok it got truncated again but heres whats inside the tweener stuff:
(MovieClip ( currentImage ) ) and the rest of the tweener stuff
- NONEIS0
var currentImage:MovieClip;
currentImage = ["nav" + colourButton];
- NONEIS0
Tweener.addTween(currentImage,{ time:0, delay:.25, transition:"linear"});
}
- kingsteven0
Tweener is not available within the scope of the event handler... 2 ways to fix this.
1: (hacky)
var self = this;
sspNavColourListener.onImageData = function(eventObject):Void {
...
self.Tweener.addTween(currentIma... time:0, delay:.25, transition:"linear"});
}- a guesskingsteven
- use pastebin and i'll tell you for surekingsteven
- Cenitgrade0
I get a Type mismatch error using NONEIS code:
found Array where MovieClip is required
currentImage = ["nav" + colourButton];kingSteven cheers for the heads up. Although I have got tweener to display the number of nav buttons based on how many images there were in an album. I'll post the whole code in a minute.
- http://pastebin.com/…Cenitgrade
- I know I've taken the long way round but hey it nearly works!Cenitgrade
- containerMovieClip... + colourButton];kingsteven
- troublesome bit is at the bottom.Cenitgrade
- argkingsteven
- don't know where to start with those conditionalskingsteven
- ignore the top bit of the pastebin code.That works. Bottom nav colour doesn't.Cenitgrade
- can you check if hideNav gets called?kingsteven
- it does, but before the conditional statements for some reason.Cenitgrade
- it to make the nav seem as if it's reloaded. which it does.Cenitgrade
- NONEIS0
Sorry, I thought this method used to work in AS2 ;\
- Cenitgrade0
So what I need to then is figure out how to use an array (i think) as an instance name?
- NONEIS0
Yeah, that's where I was going, BUT, I would highly suggest you check the SSP forums, I am sure someone else has run into this, and will be able to suggest a better method grabbing from the framework you are using. I would be stunned if there were not vars you can can grab and leverage rather than trying to hack something else together.
- kingsteven0
"So what I need to then is figure out how to use an array (i think) as an instance name?"
i'm not sure that's what you're trying to do... you can access a movieclip's child clips by using an array access operator ([]) if you know the movieclip's parent clip
ie:
var i = 0;
_root.createEmptyMovieClip("mc0... 1):
trace(_root["mc"+i]); //output: "_level0.mc0"