Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash








Retrieving Variable Outside Timeline


How do i retrieve a variable from the timeline inside a movieclip with the instance name _fader?
On the timeline i retrive som FlashVars
<param name="FLashVars" value="xml=images.xml" />

var xmlURL = _root.xml;

this xmlURL variable i want to pass inside a movieclip.
How do I do this?


if (xmlURL != "") {
this.loadXML (xmlURL);
}

};
// *** load the external xml ** //
ImageFader.prototype.loadXML = function (x) {
var _xml = new XML ();
_xml.ignoreWhite = true;
_xml.path = this;
_xml.load (x);
_xml.onLoad = function () {
for (var a = 0; a < this.firstChild.childNodes.length; a++) {
var _trans = this.firstChild.childNodes[a].attributes.TRANSITION;
var _pause = this.firstChild.attributes.PAUSE
var _img = this.firstChild.childNodes[a].firstChild.nodeValue;
this.path._dataProvider.push ({img:_img, transition:_trans, pause:_pause});
}
this.path.startFading ();
delete this;
};
};




SitePoint > Design Your Site > Flash and Actionscript
Posted on: Feb 11, 2007, 10:49


View Complete Forum Thread with Replies

Sponsored Links:

Retrieving The Value Of A Variable
Ok,

first of all, I'm not a flash programmer. I'm just trying to modify a script.

said that. I've a form which uses two movie clips as form-fields and I'm trying to make this work. I wanna when the user press the button "send", my flash retrieves the value of these two fields and then send to the webpage. The "sending" part I think is easy. The problem is that I cannot retrieve the value of these fields.

Probably its really easy for you guys, but not for me. As i'm not a flash programmer. Here's the code I'm using to test. It returns null:


Code:
on (release) {
trace("password: " + passwd );

}
Now, here's the debug screen (I did a "Find" for all "passwd" occurences):

Code:
Movie Clip: Target="_level0.instance56"
Variable _level0.instance56.passwd = "testing123"
Edit Text: Target="_level0.instance56.instance57"
hscroll = 0,
htmlText = "testing123",
length = 10, tabIndex = undefined, html = false, selectable = true,
type = "input",
background = false, scroll = 1, backgroundColor = 16777215, condenseWhite = false,
border = false, textHeight = 14, borderColor = 0, thickness = 0,
textWidth = 70, mouseWheelEnabled = true, wordWrap = false,
antiAliasType = "normal",
variable = "passwd",
sharpness = 0, embedFonts = false,
text = "testing123",
filters = [object #71, class 'Array'], maxhscroll = 0, maxscroll = 1, textColor = 7500402,
autoSize = "none",
restrict = null, bottomScroll = 1, password = true, maxChars = 20,
styleSheet = undefined,
gridFitType = "pixel",
multiline = false
so the value is there "testing123" how to get this?

thanks!

View Replies !    View Related
Retrieving Variable From Level
Hi,

I'm trying to retrieve a variable I declare on level 5 from level 1. The var on level 5 is set like this:

cover_kleur = uur_kleur.getRGB().toString(16);

In level 1 I want to use the RGB code to color a movieclip. I try to retrieve the value like this:

kleur_no = _level5.uur.cover_kleur;

Pretty straight forward I should think but no, I keep getting an undefined. I load the levels first and tried retrieving the var after that, in the next frame and in frame 10 but it stays undefined.

It does show when I list the vars in test movie mode but only in level 5.

Can someone please help? Thanks, Danielle.

View Replies !    View Related
Retrieving A Variable From A JS File?
The title says it all...
Please help.

The example can be:
www.mywebsite.com/javascriptfile.js

with variable name:
thisVariable

I was thinking something like
loadVariables

View Replies !    View Related
(F8)Retrieving A Variable From Php Into Flash
Hey,


I’d like to grab the variable out of the PHP’s url into flash. So if my url is
www.flashsite.php?website=site I will retrieve the variable website and it will declare the value of “site”.

Basically I have 5 different sites coming to 1 contact form in a flash movie. I’d like to record which site they’ve come from. I can do this from the variable in the index.

View Replies !    View Related
Retrieving Variable From Nested Mc
First let me explain the situation. On the main timeline I have a text box that loads in HTML files I also have 5 buttons that dictate what HTML file is loaded into the text box. Each button is named sequentially (menu1, menu2, menu3...) The way its coded now (on the main timeline there is an onRelease function for each button) its a lot of code. Is there a way to tell which button is clicked and then assign a variable to load a function to determine the HTML file? ahh here is the code I have.


ActionScript Code:
//function to define button events
function setupMenu() {


    for (var i:Number = 1; i<6; i++) {
       
        right_panel_mc.glass_menu_mc["glass"+i].onRollOver = glassfoward;
        right_panel_mc.glass_menu_mc["glass"+i].onRollOut = glassback;

//this is where im lost, need to assign a different PAGE number to each button to be executed onRelease of that button

right_panel_mc.glass_menu_mc["glass"+i].onRelease = loadingtext;


    }


}
//function to load the text file using variable PAGE
function loadingtext() {
    var lorem_lv:LoadVars = new LoadVars();
    lorem_lv.onData = function(src:String):Void  {
        if (src != undefined) {
            right_panel_mc.text_holder_mc.text_mc.htmlText = src;
        } else {
            right_panel_mc.text_holder_mc.text_mc.htmlText = "Unable to load external file.";
        }
    };
    lorem_lv.load("../text/page"+PAGE+".html");
}

View Replies !    View Related
Retrieving Instance Name & Using Variable In Target
My name is Manuel Mejia manipublic@mac.com. I am building a virtual tour with panoramas in Flash for Best Friends Animal Sanctuary http://www.bestfriends.org. The interface consists of a map on the left and an empty Movie Clip on the right that Panoramas load into. What triggers a panorama is a button (PanoButton) on the map that is embedded in a movieclip. This movie clip (PanoButtonMovie) has two frames, the first contains the PanoButton that does the triggering, and the second frame contains an icon that turns with the Panorama. This project is a big one and I only want to have one PanoButtonMovie symbol in the library with many instances that each trigger a diferent Panorama. My solution is to name each instance acording to the Panorama that it's button will trigger.

My first problem lies in retrieving the instance name from each PanoButtonMovie instance to load the right panorama.
My next problem lies in finding out which PanoButtonMovie is set to frame two (turning icon) and set it back to frame one (button) before the button that is being pressed changes to a turning icon.

This is my script attatched to the PanoButton (in the first frame of the PanoButtonMovie):

Code:
on (release) {
ActiveName = getProperty ( this, _name );
_root.AllMaps.DetailMap.ButtonShell[_root:PanoName].gotoAndStop( 1 );
loadMovie ( ActiveName + ".swf", _root.shell);
_root:PanoName = ActiveName;
trace ("ActiveName =" + ActiveName);
trace ("PanoName =" + _root:PanoName);
play ();
}
The second and fourth lines are what puzzle me. I was getting a panorama to load from this script earlier, then I changed something and I think I changed it back but it doesn't load any thing. I can't spot what's wrong with these lines.
The third line I'm just not sure about. I'm trying to reference a variable on the root timeline and insert it's value into the target. I need to know which PanoButtonMovie instance is set to the turning frame (which one was last pressed) and set it back to frame 1. I want to know a good way to acomplish this. ("PanoName" is an empty variable sitting in the first frame of my root timeline.)
In the "Output" window, when I test the movie, I see that ActiveName has no value, and hence Flash cant find a file called ".swf". Why is this ?

If you have the time and ability to help me address this problem I would love some input. I've posted my FLA to download and I will mail a link to you if you ask. Here's the main interface SWF http://www.monitor.net/~manuel/BF_FlashTour.swf for reference, and the panoramas http://www.monitor.net/~manuel/KTV_out1.swf and http://www.monitor.net/~manuel/KTV_out2.swf that are supposed to be loaded. They would appear in the bottom right corner of the main interface when you cliked on one of the two cats on the map (outside the buildings).
[Edited by mani_sf on 01-10-2002 at 03:15 AM]

View Replies !    View Related
Retrieving A Variable From An Html Page
Here's my scenario:
Two flash movies load into a page, a mouse event in the first movie uses getURL("javascript: funciton()") to set a variable in the parent html page. The second flash is using an onClipEvent(enterFrame) to constantly check for a change in this variables value before it runs certain timelines. The trick is, how do I get that variable back into the flash?

I've tried using the loadVariables to bring in the parent html page, but, of course, all I get is a big jumbled mess of javascript and html. Is there a smart way to grab a unique variable from this page? My only idea is bringing in all of this jumbled info and then parsing out the exact string using indexOf, but this seems quite messy. Any other ideas? Thanks in advance.

Quasi

View Replies !    View Related
Flash Retrieving Variable Name From Html
hi

is it possible to have a swf load a variable name into itself from the html page in which it is embed. bit of a shoddy explaination, but something like this;

<OBJECT "flash" etc.
- loadswf "arse.swf"
- param="this is the variable that the swf needs" // or "arse.mp3"
OBJECT>

obviously this is a fine example of html coding, but ignoring that, is this kind of approach possible? if anyone knows whether this IS, or IS NOT possible, i would be very grateful if you could share your knowledge.

cheers in advance

sifu

View Replies !    View Related
(as) Displaying/Retrieving Data From A Variable
There must be someone who can help me with this!

I have an input field that sends the input data to a dynamic text field.. (variable) pretty simple...

But, how do i, from another part of the flash movie, display/retrieve whats been stored in that variable and/or put it into a text box????

Please any help!

In appreciation and admiration...

View Replies !    View Related
Retrieving Variable Values From Within Another Movie Clip
Dude - Where's my variable?

I need to reference a variable value on the main timeline, from within a movie clip. On the main timeline I have defined the variables thus:

chart = 0;
bird = 0;
fuel = 0;
charge = 0;
computer = 0;
astro = 0;
door = 0;
roof = 0;
starteng = 0;
launch = 0;

and within the seperate movie I need to pull the variable value into, I have used:

if (../mainMovie:chart=1) {
setProperty (tick1, _visible, true);
} else {
setProperty (tick1, _visible, false);
}

Is this right, AAARGHHHHHH HELP!

View Replies !    View Related
Problem Assiging Class Variable To The Main Timeline Variable .... PLEASE HELP
Hi Guys

I just can't seem to solve this problem!!!

I have a random class that generates a random image and an id number from an xml file and a main class that reads information from an xml file according to the id number.

I'm having trouble assigning my random id number from my class to the _root.id variable on the main timeline for my other class to read. I keep getting undefined???

Random Class Code:


Code:

import mx.utils.Delegate;
class randomClass {

public var target_mc:MovieClip;
private var _xml:XML;
private var myTotal:Number;
private var random_number:Number;
public var myFid:Number;
private var myPic:String;
private var myTitle:String;

private var myImages:Array = new Array();
private var myTitles:Array = new Array();
private var myFids:Array = new Array();
function randomClass(url:String, target:MovieClip)
{
target_mc = target;
_xml = new XML();
_xml.ignoreWhite = true;
_xml.onLoad = Delegate.create(this, onLoadEvent);
_xml.load(url);
}

function onLoadEvent(success:Boolean):Void
{
if (success)
{
var i:Number;

myTotal=_xml.firstChild.childNodes.length;

for(i=0; i<=myTotal-1; i++)
{
myImages[i]=_xml.firstChild.childNodes[i].firstChild.firstChild;
myTitles[i]=_xml.firstChild.childNodes[i].firstChild.nextSibling.firstChild;
myFids[i]=_xml.firstChild.childNodes[i].firstChild.nextSibling.nextSibling.firstChild;
}

random_number=random(myTotal);

myPic="<A href="http://www.mydomain/images/"+myImages[random_number">http://www.mydomain/images/"+myImages[random_number];
myTitle=myTitles[random_number];
myFid=myFids[random_number];

target_mc.title.text=myTitle;

var TheMovieLoader = new MovieClipLoader();
TheMovieLoader.loadClip(myPic, target_mc.new_mc);

var pictureLoaderListener = new Object();
pictureLoaderListener = TheMovieLoader.onLoadComplete()
{
target_mc.new_mc._x=-9;
target_mc.new_mc._y=-5;
target_mc.new_mc._xscale=40;
target_mc.new_mc._yscale=40;
}
TheMovieLoader.addListener(pictureLoaderListener);
target_mc.random_id.onPress = Delegate.create(this, onPressEvent);
}
}

public function onPressEvent() {
_root.id=myFid; //Undefined
trace(myFid); //ok
}
}

Main Movie Code:


Code:

on (press) {
var Obj:myClass=new myClass("<A href="http://mydomain/fanbase.xml",_root.viewer">http://mydomain/fanbase.xml",_root.viewer, _root.id);
}
It just keeps saying undefined but yet i seem to be able to trace myFid

Any ideas???

Thanks in advance

View Replies !    View Related
Problem Assiging Class Variable To The Main Timeline Variable .... PLEASE HELP
Hi Guys

I just can't seem to solve this problem!!!

I have a random class that generates a random image and an id number from an xml file and a main class that reads information from an xml file according to the id number.

I'm having trouble assigning my random id number from my class to the _root.id variable on the main timeline for my other class to read. I keep getting undefined???

Random Class Code:


Code:

import mx.utils.Delegate;
class randomClass {

public var target_mc:MovieClip;
private var _xml:XML;
private var myTotal:Number;
private var random_number:Number;
public var myFid:Number;
private var myPic:String;
private var myTitle:String;

private var myImages:Array = new Array();
private var myTitles:Array = new Array();
private var myFids:Array = new Array();
function randomClass(url:String, target:MovieClip)
{
target_mc = target;
_xml = new XML();
_xml.ignoreWhite = true;
_xml.onLoad = Delegate.create(this, onLoadEvent);
_xml.load(url);
}

function onLoadEvent(success:Boolean):Void
{
if (success)
{
var i:Number;

myTotal=_xml.firstChild.childNodes.length;

for(i=0; i<=myTotal-1; i++)
{
myImages[i]=_xml.firstChild.childNodes[i].firstChild.firstChild;
myTitles[i]=_xml.firstChild.childNodes[i].firstChild.nextSibling.firstChild;
myFids[i]=_xml.firstChild.childNodes[i].firstChild.nextSibling.nextSibling.firstChild;
}

random_number=random(myTotal);

myPic="<A href="http://www.mydomain/images/"+myImages[random_number">http://www.mydomain/images/"+myImages[random_number];
myTitle=myTitles[random_number];
myFid=myFids[random_number];

target_mc.title.text=myTitle;

var TheMovieLoader = new MovieClipLoader();
TheMovieLoader.loadClip(myPic, target_mc.new_mc);

var pictureLoaderListener = new Object();
pictureLoaderListener = TheMovieLoader.onLoadComplete()
{
target_mc.new_mc._x=-9;
target_mc.new_mc._y=-5;
target_mc.new_mc._xscale=40;
target_mc.new_mc._yscale=40;
}
TheMovieLoader.addListener(pictureLoaderListener);
target_mc.random_id.onPress = Delegate.create(this, onPressEvent);
}
}

public function onPressEvent() {
_root.id=myFid; //Undefined
trace(myFid); //ok
}
}

Main Movie Code:


Code:

on (press) {
var Obj:myClass=new myClass("<A href="http://mydomain/fanbase.xml",_root.viewer">http://mydomain/fanbase.xml",_root.viewer, _root.id);
}
It just keeps saying undefined but yet i seem to be able to trace myFid

Any ideas???

Thanks in advance

View Replies !    View Related
Problem Assiging Class Variable To The Main Timeline Variable .... PLEASE HELP
Hi Guys

I just can't seem to solve this problem!!!

I have a random class that generates a random image and an id number from an xml file and a main class that reads information from an xml file according to the id number.

I'm having trouble assigning my random id number from my class to the _root.id variable on the main timeline for my other class to read. I keep getting undefined???

Random Class Code:

Code:
import mx.utils.Delegate;
class randomClass {

public var target_mc:MovieClip;
private var _xml:XML;
private var myTotal:Number;
private var random_number:Number;
public var myFid:Number;
private var myPic:String;
private var myTitle:String;

private var myImages:Array = new Array();
private var myTitles:Array = new Array();
private var myFids:Array = new Array();
function randomClass(url:String, target:MovieClip)
{
target_mc = target;
_xml = new XML();
_xml.ignoreWhite = true;
_xml.onLoad = Delegate.create(this, onLoadEvent);
_xml.load(url);
}

function onLoadEvent(success:Boolean):Void
{
if (success)
{
var i:Number;

myTotal=_xml.firstChild.childNodes.length;

for(i=0; i<=myTotal-1; i++)
{
myImages[i]=_xml.firstChild.childNodes[i].firstChild.firstChild;
myTitles[i]=_xml.firstChild.childNodes[i].firstChild.nextSibling.firstChild;
myFids[i]=_xml.firstChild.childNodes[i].firstChild.nextSibling.nextSibling.firstChild;
}

random_number=random(myTotal);

myPic="<A href="http://www.mydomain/images/"+myImages[random_number">http://www.mydomain/images/"+myImages[random_number];
myTitle=myTitles[random_number];
myFid=myFids[random_number];

target_mc.title.text=myTitle;

var TheMovieLoader = new MovieClipLoader();
TheMovieLoader.loadClip(myPic, target_mc.new_mc);

var pictureLoaderListener = new Object();
pictureLoaderListener = TheMovieLoader.onLoadComplete()
{
target_mc.new_mc._x=-9;
target_mc.new_mc._y=-5;
target_mc.new_mc._xscale=40;
target_mc.new_mc._yscale=40;
}
TheMovieLoader.addListener(pictureLoaderListener);
target_mc.random_id.onPress = Delegate.create(this, onPressEvent);
}
}

public function onPressEvent() {
_root.id=myFid; //Undefined
trace(myFid); //ok
}
}
Main Movie Code:


Code:
on (press) {
var Obj:myClass=new myClass("<A href="http://mydomain/fanbase.xml",_root.viewer">http://mydomain/fanbase.xml",_root.viewer, _root.id);
}
It just keeps saying undefined but yet i seem to be able to trace myFid

Any ideas???

Thanks in advance

View Replies !    View Related
Timeline Variable
Hi all;
i have a question(for me a big problem) about timeline variable.
in my movie clip i declined 2 variable in timeline.One is

gui = kere // at frame "1"
gui = deli // at frame"10"

both has a stop action.And I want my button react according to this variables.

So when i write this script
if (gui==kere){
myMovieClip.Play();//And my movieClip goes to frame tha shows gui==deli
Problem is when i add new lines lie " else" or another "if" statement that stars with gui ==deli,not working.

Also i got trace for both varible.Problem i think is first variable in frame 10 not changes.It remains.So how to solve this any idea?

I hope it's clear.

Thanks

View Replies !    View Related
Refer To Variable In Timeline Of Same MC?...with
Hi!
I have a complex project-structure with several MCs nested on two levels. Now I'd like to call a variable that is actually in the same MC where I call the variable from (hope that is clear...). I don't want to put the whole absolute path in (like _level2.MC1.MC2.myVariable etc.). Can I refer to the variable with the "this" keyword instead? And how exactly do I have to do this? I can't figure it out.
thanx very much!
mink

View Replies !    View Related
Variable To Main Timeline
okay, i have this great idea about how i'm going to make my flash site, but not exactly what to do to accomplish it

lets say i have a main movie. call it main.swf.
main.swf imports the menu, called menu.swf.
when a button is clicked on menu.swf, it passes a variable containing the button/choice to the main timeline, plays an animation, then pulls up a swf with the content for that choice.

so basically the swf that comes up after the animation is based on the variable that is passed from an imported swf to the main timeline.

any ideas on how i could do this?
(and i hope i explained myself well)

thanks,
chris

View Replies !    View Related
Timeline Variable Problem
hey guys,

ive got a problem..
im loading xml into a function and i wanna take a variable out of that function and put it on a timeline variable. How can this be done ?

this is what ive got:

..loading xml code.. ->
var hey;
settingsXML.onLoad = function() {
hey = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
};
trace(hey)

thanks in advance

View Replies !    View Related
Getting Variable To Pause Timeline
Hello,
Here is my actionscript code:

Code:
loadVariablesNum("http://url.com/test.txt",0,"GET");
var n = delaytime;
stop();

function wait() {
stop();
var myInterval = setInterval(function () {
play();
clearInterval(myInterval);
}, n * 1000);
}

wait();
And here is my text file code:

Code:
&delaytime=5
I'm trying to pause the timeline by getting data from a text file. For some reason I cant get the "delaytime" data in the actionscript to work. Anyone know where I'm going wrong? Thank you.

View Replies !    View Related
Variable Timeline Linking
i have a scenario in which i have twelve buttons that each lead to a different timeline. when they are clicked, an intro is played into their timeline, and when the user clicks to leave and go back to the page with the twelve buttons, an outro is played. What i want to be able to do is make each button accessable from within the timelines of all the other buttons, but in order to do this i would have to be able to tell flash in some way that when "Button B" is clicked from within "Timeline A", it plays to a certain frame (the outro) and then jumps to "Timeline B." This is easy. What i can't figure out is how to tell it to jump to "Timeline C" when "Button C" is clicked also from within "Timeline A" and also play the same outro.

Any suggestions? Am I making this way to hard?

Right now i have a 13th button that the user clicks in order to go back. If this is too confusing, you can take a look right now at

http://flash.setaction.com

thanks!

-Keith

View Replies !    View Related
Referencing Variable On Another Timeline
Hi gang,

I've got a simple scenario which has been causing some distress and confusion for me. I have a movie clip placed on the stage, which has a variable defined within it. My question is...how can I reference that variable from the _root timeline, without instantiating any on{} statements?

Sounds simple, yes...but I'm unable to do this. I've tried setting the variable in a variety of ways (var, global, Object, etc). No matter how that variable is set, I simply cannot reference from the main timeline, without reading the variable in an on statement block

ex.
trace(_root.mcTest.strTest); // invalid

on(press) {
trace(_root.mcTest.strTest); // correct
}

Thanks in advance to anybody who can enlighten me.

View Replies !    View Related
Variable Timeline Jumping
i have a scenario in which i have twelve buttons that each lead to a different timeline. when they are clicked, an intro is played into their timeline, and when the user clicks to leave and go back to the page with the twelve buttons, an outro is played. What i want to be able to do is make each button accessable from within the timelines of all the other buttons, but in order to do this i would have to be able to tell flash in some way that when "Button B" is clicked from within "Timeline A", it plays to a certain frame (the outro) and then jumps to "Timeline B." This is easy. What i can't figure out is how to tell it to jump to "Timeline C" when "Button C" is clicked also from within "Timeline A" and also play the same outro.

Any suggestions? Am I making this way to hard?

Right now i have a 13th button that the user clicks in order to go back. If this is too confusing, you can take a look right now at

http://flash.setaction.com

thanks!

-Keith

View Replies !    View Related
Can't Access Timeline Variable
I have a movie clip I'm duplicating.

This movie clip is only one frame long and has a couple
variables and functions in an actions layer on that
first frame.

When I duplicate the movie clip I can't access either
the variables on the timeline or the functions. What
am I doing wrong here.

MovieClipA
var blee
var blah

var tempClip:MovieClip = MovieClipA.duplicateMovieClip('createdClip', 100);

trace(tempClip.blee) // This comes back undefined.

Is it not possible to retain the variables and functions
inside a movie clip when it gets duplicated?

I know you can define the variables and functions after
the duplication but I'd like to be able to have them almost
like class attributes / methods for when a new clip is duplicated.

Let me know if this is possible or if I'm smokin' crack.

Thanks.

View Replies !    View Related
Referencing Variable On Another Timeline
Hi gang,

I've got a simple scenario which has been causing some distress and confusion for me. I have a movie clip placed on the stage, which has a variable defined within it. My question is...how can I reference that variable from the _root timeline, without instantiating any on{} statements?

Sounds simple, yes...but I'm unable to do this. I've tried setting the variable in a variety of ways (var, global, Object, etc). No matter how that variable is set, I simply cannot reference from the main timeline, without reading the variable in an on statement block

ex.
trace(_root.mcTest.strTest); // invalid

on(press) {
trace(_root.mcTest.strTest); // correct
}

Thanks in advance to anybody who can enlighten me.

View Replies !    View Related
Play Timeline Until Variable Changes - How To?
What I'm trying to do is this:
I have a movie clip that on mouse over play the frames "show" and in roll out play the frames "hide"

But I want the movie to play "show" until the variable name "menuPlaying" changes.

main time line:

Code:
menuPlaying = 0;
stop();
Stage:

Code:
on(rollOver) {
_root.menuPlatform.gotoAndPlay("show");
}
on(rollOut) {
_root.menuPlatform.gotoAndPlay("hide");
}
Inside menuPlatform movie clip I have the animations labeled "show" and hide"

I only have 1 frame in the main timeline.

View Replies !    View Related
Calling A Variable On Main Timeline From A MC
Hello,

I'm setting a variable for the current frame while on the main timeline. But then I need to use it while in a MC. Does anyone know how I would call the variable from the MC?

Here's the code I have that's not working:

on main timeline:
Set Variable: "currFrame" = _currentframe

In the MC:
On (Release)
Set Variable: "mainFrame" = currFrame
Set Variable: "linkLine" = "../search/search_questions.cfm?framenumber="&mainFrame
Get URL (linkLine, window="_blank")
End On

When I change currFrame to a number, everything works great so I know that the only problem is that I'm not calling the variable correctly. I also tried ../currFrame but that didn't work either.

Any thoughts?

THANK YOU
Janet

View Replies !    View Related
How Do I Reference A Mc's Variable From The Main Timeline?
I have a variable that is set in a MC and want to be able to reference it in the main timeline controller..

the variable I want to reference is a dynamic text variable that obtains its value from a timer.

do I need to turn this local variable into a global using the localToGlobal(var) function?

if I dont how do I set a variable in the timeline that has the value of the mc.dynamicText field ?

Thanks in advance
Skek

View Replies !    View Related
Sending A Variable To A Function Further Down The Timeline
What i am trying to do is this:

when a button is hit, a mask closes (with a tween, so it takes a second or two). However, since what is shown in that mask varies on prior user decisions I want to change the _alpha of what WAS shown before the mask closed up. However, I want to do this AFTER the mask closes, so I don't think I can attatch this simply to the button that caused the mask to close.

What I was hoping to do actionScript wise was setting up a function (not sure where, on the timeline?) that will run once the mask has closed, however, to make it generic I was hoping to pass in a variable from the button letting me know which button was hit. I can pretty much figure what the code would be if i wanted to do it right when the button was hit, but with the delay I am not sure how to call, or where to place the function in order to have it run after the mask is done and also pass a variable from the button into it. Any ideas?

Thanks

View Replies !    View Related
Passing Variable From MC To Main Timeline
I have 2 frames in my main timeline both with stop actions. The first frame has a movie which is basically an intro. At the end of this intro movie i wanted to specify a variable so that the main timeline would play to frame 2. It seemed simple enough with the _global setting but i cannot get it to work with that or _root. In my main timeline in the first frame i have:

if(z < 13) {
stop();
}else if(z == 13){
gotoAndStop(2);
}


In the MC that sits in the first frame I've tried:

_global.z = 1;
_root.z = 1;

at the end of that MC but neither of those pass varibles to the main timeline (i've been using trace). I'm starting to think my Flash MX is posessed because i've read posts on this board which say how to use global variables but it isn't working for me. Please help. I've spent too many hours on this one problem.

Thanks!

View Replies !    View Related
Change Root Timeline From MC Using Variable
(this is a flash 5 question)
i'm going to post the .fla because it is easier than trying to explain everything in detail.

basically i have two images on the root timeline.

i have two blank MC's constantly running, the last frame of each changes a variable.

this variable controls whether the root timeline displays the first image or the second image.

the code works in my head, but when run it just sits on the first image and does not change. i have a blank first frame so that the controlling variable is set once at the beginning but thereafter is set by the MC's.

many thanks in advance

View Replies !    View Related
Set Variable On Main Timeline For Mc Action
I have a button inside a movie clip which should set a variable on the main timeline.

example:

main timeline -
myText.text = thisText;



Movie clip -
on(release){
thisText="Sample Text"
}


I tried adding _root to thisText in the movie clip but this didn't work. Is there something else I should try.


Thanks

View Replies !    View Related
Timeline Variable Now Not Working In Flash 7
Bear in mind this code has been working perfectly published as flash 6, but when published as flash 7 it seems not work anymore.....
simple timeline variable stuff for documenting the position of a menubar thingy.

I set variable on _root.mainmovie timeline...

musicmenu = 0;

then when a menu drops down at different times in clip called "music"
and i set variable with....

_root.mainmovie.musicmenu = 1;

then....

if (_root.mainmovie.musicmenu == 1) {
_root.mainmovie.music.gotoandPlay("close");
} else if (_root.mainmovie.musicmenu == 2) {
_root.mainmovie.music.gotoandPlay("stopper");
} else {
gotoAndPlay("ender");
}

now - all target paths etc should be ok since it all works as flash 6.
the code is so simple that i just can't see why it's changed in flash 7.
i mean - all the "if" statements are the same aren't they and from what i read setting timelime variables is the same.
when i debug i can see it seeting the variable ok, just the "if" statement bit seems now not to work.
I'm pretty sure my frame names of "close" "starter" "stopper" "ender" etc aren't now flash 7 reserved names...
but when of course i re-publish as flash 6 and test - it works again == weird!!

must be a simple answer here i think...........hmmm
any tips appreciated

View Replies !    View Related
Help With Variable Passing To Main Timeline
on main timeline, I declared a varibale;

var nextSection:String;
nextSection = "sample1";

and I have a MC with 20 frames
on the 10th frame

parent.content_mc.gotoAndStop(parent.nextSection);

but I am getting all sorts of errors,

1119: Access of possibly undefined property nextSection through a reference with static type flash.displayisplayObjectContainer.

would some-one explain why this is and how I can correct it ?

attached the fla also.

Thanks in advance.

View Replies !    View Related
Pass Variable From Timeline To Class
I am totally new in actionscript 3 and running into a problem I somehow cannot solve: pass a variable from timeline to a class.

This is the code in the class:

package {
import flash.display.MovieClip;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import fl.controls.listClasses.CellRenderer;
import fl.controls.ScrollBarDirection;

public class VideoPlaylist extends MovieClip {
private var xmlLoader:URLLoader;

public function VideoPlaylist():void {
// Load the playlist file, then initialize the media player.
xmlLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, initMediaPlayer);
xmlLoader.load(new URLRequest("videoPlaylist1.xml"));
// Format the tileList, specify its cellRenderer class.
....
}
What I would like to do is replace videoPlaylist1.xml by a variable which will be assigned in the timeline and then passed to VideoPlaylist().
Somehow I cannot figure out what code to place on the timeline?
Any help would be appriciated very much!!!

View Replies !    View Related
Changing Variable In Component From Timeline
hello

i have a component that places mc's in a random pattern on the page
they then slide around in relationship to mouse proximity
the code for this all lies within the component

but

when click on a button in the main timeline
i want to change one of the variables within the component

is this possible?
if so i cannot seem to find the correct path to the variable...?

any suggestions would be appreciated

thanks

View Replies !    View Related
Losing Variable When MC Timeline Loops...
Hello,

I'm using an XML audioplayer that was built from a simple tutorial on pixel 2 life.

http://www.pixel2life.com/twodded/t_...ng_xml_/page4/

the problem is, I am trying to animate (horizontal scroll) the dynamic text field that displays XML loaded text because often times the song titles are longer than the horizontal space allowed. The scroll works just fine until the end of the scroller clip timeline, when it seems that the variable resets and the text is no longer visible until the next song loads. I have a gotoAndPlay to loop the clip at the end of the timeline so this is not the issue.

Any way to keep this variable from getting reset? Or should I be moving the text scroller movieclip with Math (which I'm NOT good at).

View Replies !    View Related
Pass Variable To Main Timeline Help
Hi, I am having trouble passing a variable to the root (main timeline) when a button is pressed from a MC.

this is the code that I have inside of the MC.

ActionScript Code:
this.onPress = this.onRelease = function(){
    a = this._currentframe;
    _root.b = a;
    _root.gotoAndPlay ("visitedState")
}


Basically I want to pass the value of variable 'a' onto variable 'b' on the main timeline... but for some reason this is not working. Any help will be appreciated. Thanks

View Replies !    View Related
Passing A Variable Change From A MC To The Main Timeline. Help?
I want to change the status of a variable that has been introduced on the main level, from a movie clip!

The variable is 'fin' , the variable fin is set to NO when a button is rolled over (which starts a movie clip), I DONT WANT ANYOTHER BUTTONS TO WORK UNTIL THAT MC IS FINISHED PLAYING...

SO at the end of that movie clip I want to change fin to "YES" ,

HOWEVER, of course the normal fin="yes" didnt work and neither did _root.fin="yes" ....can someone please help me?

thanks ! tv

View Replies !    View Related
Detect Variable Change/effect Timeline?
I almost finished with a puzzle game but am hooked up on one last obstacle.

Every time a user places a piece into place the script increases the puzzle variable by 1. This part functions great. The reason I have this variable is so I can check when it reaches 9 (9 pieces in place would be a completed puzzle) Here is my problem. I am having trouble getting the if statement to detect and change the main timeline when the puzzle is completed. The timeline needs to advance to the next frame.

Below is the actionscript I have attached to my puzzle pieces. Tell me what's wrong. Thanks!!


Code:
on (press) {
startDrag (_root.piece1);
}
on (release) {
stopDrag ();
}
on (release) {
if (this.hitTest(_root.s3)) {
setProperty (_root.cp3, _alpha, 5);
setProperty (this, _visible, false);
_root.puzzle = _root.puzzle+1;
if (_root.puzzle = 9) {
gotoAndPlay ("Main", "the_end");
}
}
}

View Replies !    View Related
Playing A Timeline In A Movieclip Using A Variable From Another Clip..
trying to play a timeline in a different movieclip when a hitpoint variable = 0 in a different movieclip.. cananyone suggest how to work this?

this movieclip with the timeline i want to play is and explosion and the variable is on a tank. I've placed the explosion clip on a layer inside the tank clip the variable is in the tanks object actions.. (if this helps.. )

View Replies !    View Related
Easy? Setting Main Timeline Variable From MC
I am trying to set a variable on the main timeline via a MC.

On the first frame of the main timeline I have:


Code:
stop();
leafName="SILENT RUNNING";


Then I have a MC, leafGenerator, and in the first frame I have a stop (then a new frame is chosen randomly). On the second frame I have:


Code:
leafName="AUSSIE PINE";


Finally, I have another MC, placard, with a text box inside, idText1. On the MC, I have the code:


Code:
onClipEvent(load){
this.idText1="BLUE MAPLE CREEK"
this.idText1=_root.leafName;
}


I can get the text box to display BLUE MAPLE CREEK, and SILENT RUNNING, but I can't get it to say AUSSIE PINE. How can I do this?

Any help is much appreciated; thanks in advance.

View Replies !    View Related
[MX04] Change A Mc Variable Using The Root Timeline?
Why can't I change a variable in a clip via the main timeline? The initial values are set in the clip on load.

Here is the code on the main timeline


Code:
_root.speedcalc.11second = _root.speedcalc.speed;
This just ends up as a syntax error and the variable doesn't get set.

View Replies !    View Related
[CS3] Accessing Variable On Root Timeline From Within A Symbol
I have a simple Boolean variable in the first frame of my root timeline that I would like to access/change from within a symbol. Can't figure it out for the life of me. I'd like to stay away from using a package if possible. Any help is much appreciated!

View Replies !    View Related
Accessing A Variable On The Main Timeline From A Class
Not a question - just info for people.

For some reason I reckon someone might benefit from knowing this. I struggled to learn some basics of communicating from Classes to the Timeline, and thought more information in Flashkit.com could be good.

MovieClip(root).variableNameOnTheTimeline

I kept trying 'this.parent.variableNameOnTheTimeline' but it doesn't work.

A way when using classes through Inheritence is to make a variable in the Class: eg 'var thisParent:*;' and then after the MovieClip or Object has been added to the stage, you can do 'thisParent = event.currentTarget.parent;'
and then you can access the mainTimeline.

View Replies !    View Related
How Can I Target A Variable Used In A Movie Clip On The Main Timeline?
I use a variable in a movie clip to keep time and on the main timeline I wnat to have a message at the end of the program telling you how long you've taken. How can I get the value from the variable in the movie clip to be targetted?

View Replies !    View Related
Linking To A Variable On Main Timeline From Inside Clip?
I guess the title says it all, but if I have a frame script that's a couple levels in (inside 2 movie clips), how can I link to a variable on the main timeline?

On the frame inside the clips is just a simple "var mainvariable = 3;"
But the Dynamic text field named "mainvariable" resides on the main timeline.

I can't really figure out how I'd use a _root or anything to get there. I'm sure I'm missing something obvious. Can you help?

Thanks!

View Replies !    View Related
Trigger Variable Change On Every Designated Frame On Timeline
Hi, thanks for reading!

How do you trigger a variable change on every designated frame on the timeline?

I have a _global. variable on the first frame that needs to change every time the player hits a designated frame on my timeline loop.

How do you do that?

Thanks

View Replies !    View Related
[MX04] Getting Instance Variable In Main Timeline & Arrays
i just thinking of making like 10 boxes and having a value in each. ie each is a boxbutton movieclip and in each
after it saves the times its been clicked.
then after clicking there is a button to finalize where it counts up each of the clicks from each box and shows 3 clicks for box1, 2 for box2 etcetc

just wondering if i could turn the movieclip into some sort of array like box[1],box[2], etcetc and how to use like _root.box[1].boxbutton.boxen
in boxbutton i have:
boxen = 0;

ive successfully set like _root..box1 = watever from boxbutton symbol in library but i need it to be kinda local to that symbol and the maintimeline to call each symbol's specific variable

thanks a tonne!

View Replies !    View Related
Passing A Variable From A Movie Clip To The Main Timeline
Hi,

I'm having trouble passing a variable from a movie clip in my flash file to the main timeline.
I have a movieclip with the instance name IntroNav which contains several buttons. Clicking a button sets the variable "page" to a specific name, i.e. page = "home"
However, outside of the movie clip, on the main timeline I am unable to call this variable, and "page" seems to have no value.

Can anyone tell me why this is and how to solve it?

Thanks

View Replies !    View Related
Using Variable In ASP To Select Which Label Is Played Within Flash Timeline.
Basically i have a link which acts as a return button which brings the user back to the intro page of my webpage...As the page is split up I have the flash content on 2 seperate asp pages (Intro & Main).

From my main page I would like to refer back to the intro.asp but instead of playing the full animation that plays id like for it go straight to the label 'start' within the flash document.

Could any1 help me how i would go about doing this?

View Replies !    View Related
AS 3.0 Referring A Root Timeline Variable Inside A Movieclip
Hi all,
I'm having a problem of referring a root variable defined in the first frame(as var randomListMsg:String) of the main timeline inside a movieclip. in AS 2.0 I could easily refer it by _root.variableName or _parent.variablename but I'm really confused how it works in AS 3.0.
can anybody help me in this? here is the code I used inside the movieclip. I've tried tracing it in the root timeline before these traces and it worked.

Code:
trace(this.parent[randomListMsg]); //doesn't work
trace(MovieClip(this.root).randomListMsg); //doesn't work
trace(MovieClip(this.parent).randomListMsg); //doesn't work
trace(MovieClip(root).randomListMsg); //doesn't work. returns 'undefined'
Thanks in advance.

View Replies !    View Related
Creating Slideshow: How To Pass Variable From Level1 To Control Level0 Timeline?
Hi, newbie here...

Thank you in advance for anyone that can help with my question. I appreciate your time and will not be a pest in this forum...

I am a photographer in Toronto and have a website that I have created in Flash and is located at www.ssonne.ca

I am working on creating a slideshow of all the photos on the site.
The way it works now, each button on the main movie loads in a new movie into level one using loadMovieNum. Each movie is three frames, and shows a progress bar and then a photo.

What I would like is to pass a variable from frame three of the movie on level1 to the main movie on level0 so I can check that the photo is fully loaded and then continue on with the slideshow.

Seems simple enough, yet I spent hours reading through a lot of sites and couldn't get anything to work for me.

Any help is much appreciated, and I hope you enjoy the photos if you take a look at my site...

- Stephen

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved