Click to See Complete Forum and Search --> : actionscript
Pwn'd
03-23-2005, 11:05 PM
hey guys
I am working away on an assignment and have hit a roadblock, I have to have buttons that when clicked bring up a dynamic text block or a static text block (either way I have to have both types of text blocks in the buttons)
now I have my text fields set as movieclips, which is wierd because whenever I export my .fla it keeps on playing the text boxes over and over again
here is teh script that I have created
stop();
this._parent.superman.onRelease function = () {
gotoAndStop(20);
}
but it keeps giving me errors
Frets
04-01-2005, 04:19 PM
your syntax is off
it should either be this or parent not both.
this. literally means this mc all the objects within the mc
default to that mc
_parent means level above eg the root if the mc does not exist
inside another mc or the mc that holds this.
as well it should be assigned to an object or a frame action
a function is used when you wish to have many processes running
Your function should be a separate part of the movie
then you would call the function by name
as well you shouldn't need a function.
Here is how a standard function would normally be used
onLoad() {
stop();
myXML = new XML;
myXML.onLoad = DisplayData;
myXML.load("demoText.xml");
}
function DisplayData(success) {
if (success) {
xmlOutput = this.body.childnodes.join('').split('<a ').join('<font color="#3333ff"><u><a ').split('</a>').join('</a></u></font>');
mcname.gotoAndStop(22);
Stop();
}
}
Notice how the function is called via the onload action.
Later the function is defined
once the object is fully loaded xmlOutput which is a dynamic text box
parses the xml content. as well as other actions are placed on an mc
as well as the root timeline. Myfunction is in the _root so the stop action
only refers to the _root timeline. mc's have independent timelines (except
needed to stay in the scenes timeline) So long as the actions are not in
contradiction with each other you can apply various name expr, if statements
etc into your function or for that matter on an object or frame numbers action.
In order to use a function you need to define the function
then call the function via actionscripting an object or a frame.
Niether of which is neccessary for your usage.
What you should do is place stop() in your timeline(s) to keep your movie
(and mc's)from looping.
To be honest I'm not a flash guy anymore...my interest dies out at flash5
There may be those here who can more adequately come up with a solution.
You may wish to post an fla for reference.