macdan
February 11, 2010, 11:20am
1
Hi
I wonder if anyone can help point me in the right direction.
I have a flash movie which imports variables from a plain text file, these define button names and urls.
I want to “hide” a button if no url is set in the text file.
on(rollover) {
if(button_url=“”) {
this._alpha=0;
}
}
I’m applying this to the as of the button but this doesn’t work.
Any help greatly appreciated!
The movie has to go out in Flash 6 (don’t ask!)
You could instantiate your buttons.
I’ve used AS2 here as its for Flash Player 6.
So if URL exists you instantiate the button, something like:
attachMovie("ButtonMovieClipName", "instanceName", 1);
The number is the layer.
You can also drop the button; something like this:
instanceName.unloadMovie();
Example:
if(button_url)
{
attachMovie("ButtonMovieClipName", "instanceName", 1);
}
If you have say 10 buttons just increment the instanceName and instantiate/deinstantiate them using code.
macdan
February 11, 2010, 12:28pm
3
so my button needs to be in a movie clip to do this?
is there any way of dropping the alpha / or hiding the button itself?
thanks!
Your button would be in a movieclip yes; just create movie clip buttons.
You can drop the alpha; but thats not how I do it nor how I would recommend doing it. Also I think you’ll find that would just make it invisible, but the button still clickable.
As a rule of thumb you should always instantiate dynamic elements.
macdan
February 11, 2010, 12:36pm
5
ok, thanks for the steer.