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




How Can I Pull A Variable Value From A Movie Symbol?



I am using some checkboxes in my movie. The checkboxes are a seprate movie I imported as a symbol. When the user selects a checkbox, it sets a variable to reflect the selection. I want to use that variable in the same frame the checkbox symbol resides but I can't pass it.

It is not set as a local variable either. I am a total newbie when it comes to using variables in flash.



FlashKit > Flash Help > Flash ActionScript
Posted on: 03-29-2002, 06:39 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Variable Scope Within Movie Clip Symbol
- I have created a "new symbol" of type MovieClip, named 'tester' (with 'Export for ActionScript' as class 'tester' enabled) which contains the following code:

var val:int = 10;
function testThis():void{
trace(val);
}

- In my main timeline, I have the following code:

var t:tester = new tester();
t.testThis();

Which outputs "0" instead of 10. What am I missing in my understanding of variable scope? And what is the best way to go about solving this issue (having a movie clip with its own variables, accessible by the parent)?

Pull Variable From ASP Page...
I have an ASP page that pulls info from a database. On this page I have created a Flash video player. When the page loads, I want to pass an ID variable from the ASP page to the Flash video player so it loads a specific .flv movie.

Example:
ASP page has a variable called classID. classID is equal to a number. When page loads this number gets passed into the Flash video player. The Flash video player then loads the video that has the same name as the classID number.

Make sense? I'm using CS3 with AS2.

Any help would be appreciated.

Pull PHP Variable Into Flash?
Hello everyone.

I have a page, locations.php, that pulls info from a MySQL DB. On that page I set $country equal to the 2 digit country abbreviation we have setup. What I want is for flash to be able to pull that $country variable and decide that when $country = "CA" gotoAndStop(2)

Essentially if the $country equals CA it is to play frame 2, otherwise it is to stay at frame 1. How can I do this?

Can I Pull The Current URL And Pass As Variable To Swf?
I am making a navigation menu for the basic top menu of a php driven website....

I can hard link all the buttons to certain pages, but then the animated menu resets while its included in a header.php file...

What is the best way to accomplish a seemingly seamless transition from one php page to the next without having to have the animation start over?

right now, I am using URL variables, but it makes the url so ugly....

something like, current.php?whereToStart=current

and the highlighter swf nave menu file has a variable named whereToStart so the current in the above example tells it to load with 'current' the selected state....

does that make sense?

I guess I could have 7 frames in my movie with code on each frame to bring the selector to that position, but I am still passing a url variable for the frame number then...


is there a way to pass variables from one swf, into another pages swf, without using url variables>??

also, could I load my page, have the swf actually read the current URL in the go line, the parse through it and pull from it the string necessary to communicate where to go?

I was thinking something like...

http://myurl.com/current.php

i could somehow tell it...

currentURL - minus the first X characters = current.php

then take that current.php and parse it down to a variable that is usable in my swf???

does any of this make sense????

Pull Variable In Flash SWF From HTML Page
Here's what I want to do... HTML pages home.htm, about.htm, contact.htm all have the same Flash SWF in the page for nav buttons. Each page loads with target _self, and I want to have the flash movie load on each page at a different frame number BUT I want to use the same SWF.

For Example:
home.htm starts on frame 1 and stops at frame3, when you click the About link, it loads about.htm and sets the goandplay on frame 4. Then with the contact.htm page, it loads and starts on frame 7.

I'm guessing I need a some variable in the HTML code of each .htm file to tell it were the target is to start at whatever frame I decided.

Can this be done.. and if so, where would I start?!?!

thanks,
Basher

Pull URL/variable Into Flash From HTML Params
Hello,

I havent used Flash in a long time, and am sort of getting back into it...I need a bit of help on a situation. Hopefully this makes sense...

I've got a Flash movie that has variables setup for diff sections/pieces. Those variables are being populated/pulled from the Flash params in the HTML page..example below:

<param name="movie" value="Intro.swf?companyname=My Company...">

It works great with all of the variables I have setup, but now I have a button/link in the Flash movie that I want to do the same thing too...ie asign a variable where the URL would normally go in a static Flash movie....example below:

on (release) {
getURL("http://www.google.com/", "_self");
}


So, what I want to do, is instead of having the GOOGLE URL there, I want to be able to put maybe a variable there, and pull that from the params, like all the other ones I have setup in the HTML...

Is this possible, and what would the sytax be? Any help or examples would be hugely appreciated...

Thanks...

Note..I'm using Flash 8

Pull Variable In Flash SWF From HTML Page
Here's what I want to do... HTML pages home.htm, about.htm, contact.htm all have the same Flash SWF in the page for nav buttons. Each page loads with target _self, and I want to have the flash movie load on each page at a different frame number BUT I want to use the same SWF.

For Example:
home.htm starts on frame 1 and stops at frame3, when you click the About link, it loads about.htm and sets the goandplay on frame 4. Then with the contact.htm page, it loads and starts on frame 7.

I'm guessing I need a some variable in the HTML code of each .htm file to tell it were the target is to start at whatever frame I decided.

Can this be done.. and if so, where would I start?!?!

thanks,
Bash3r

Pull Variable In Flash SWF From HTML Page
Here's what I want to do... HTML pages home.htm, about.htm, contact.htm all have the same Flash SWF in the page for nav buttons. Each page loads with target _self, and I want to have the flash movie load on each page at a different frame number BUT I want to use the same SWF.

For Example:
home.htm starts on frame 1 and stops at frame3, when you click the About link, it loads about.htm and sets the goandplay on frame 4. Then with the contact.htm page, it loads and starts on frame 7.

I'm guessing I need a some variable in the HTML code of each .htm file to tell it were the target is to start at whatever frame I decided.

Can this be done.. and if so, where would I start?!?!

thanks,
Basher

[MX04] Merging Strings Into A Variable To Pull Out An Array Value
Ok, so here's the deal.....

I have two dropdown lists who's values when merged them represent an array name.
For example... I make a selection from a dropdown list 1 who's value is "SomeArray", and from the dropdown list 2 i select an item with value "No1"

So now i want to merge those two and add a number from which place in array to take a number to display it in a text field...
Something like a variable called SomeArrayNo1[0] so afterthat I can put it into a text filed....

I know my English sucks, but please help me....
The code below puts a word "SomeArrayNo1[0]" into teh text field instead of pulling the number from array.


Code:
SomeArrayNo1 = new Array("10", "20", "30", "40");
var Droplist1 = new String ("SomeArray")
var Droplist2 = new String ("No1")
var ArrayPosition = new String ("[0]")
TraceNumberFromArray = Droplist1+Droplist2+ArrayPosition
trace(TraceNumberFromArray);
_root.textfield.text = [TraceNumberFromArray]

[MX2004] Movie Symbol As A Button Symbol
I have a scrollout menu for my flash movie, but each of the buttons have to be movies symbols. I try to attach:

on (release) {
gotoand stop(4)
}

But I get the error that this script only works for buttons. Anyone able to lend some assist? I suck at actionscript. ;p

[MX2004] Movie Symbol As A Button Symbol
I have a scrollout menu for my flash movie, but each of the buttons have to be movies symbols. I try to attach:

on (release) {
gotoand stop(4)
}

But I get the error that this script only works for buttons. Anyone able to lend some assist? I suck at actionscript. ;p

Button To Pull Movie
Total newbie to scripting. I'm using Flash MX. I am creating a Jeopardy game for a presentation. When I click on one of the dollar amounts, or buttons, I want it to pull a movie clip of a question moving out to covering aprx. 80% of the screen. Once the question is read and I don't need it anymore I want the movie to go away and the button to change so there is no dollar amount on the screen. I tried just putting the movie clip on the over state and it will show up but then when I roll off it I don't know how to make the dollar amount go away. Is there a way I could code it to say something like " on release go to and play "whatever movie clip I want it to" and then have it change the button so it has no dollar amount? Or, instead of using buttons, could I just use a movie clip and say something like "On release play"?

I will attach my .fla file. If you take a look, I scrapped as much as I could so i could send it. The $300 button called "BottomLeftBtn", when i click it I would like it to run "BottomLeftMv." Then when I am done with the question I need a way for the movie to go away and the dollor amount to be blank.

Not sure what is the best way, any recomendations are appreciated.

Thanks in advance for any help, I'm really struggling with this.

Symbol -> Movie Clip Symbol?
how do i make a symbol a movie clip symbol also?

Movie Symbol & Button Symbol
Hello,

CAn someone tell me how to make an animation/movie a button?

www.humanbloom.com/links

The "goverment resources" is a movie symbol and I need it to link to another webpage. Now I have tried to make the button first & then add the animation it has now, but of course it needs the mouse in order to do something. So I am lost on how I get it to do what I want it to animation wise and make it a button too>?

Movie Symbol & Button Symbol
Hello,

CAn someone tell me how to make an animation/movie a button?

www.humanbloom.com/links

The "goverment resources" is a movie symbol and I need it to link to another webpage. Now I have tried to make the button first & then add the animation it has now, but of course it needs the mouse in order to do something. So I am lost on how I get it to do what I want it to animation wise and make it a button too>?

Can I Pull A Frame From A Different Scene In The Same Movie?
I have a movie with two scenes. One scene called "Data Layer" is one layer and thirty cells, each with a progressive piece of animation in it. What I want to do is have the second scene create a variable (for instance, a random number 1-30), and then do this: Pull from "Data Scene, Layer 1, Frame X", where X is the random number created above. The number won't always be random, but that important part is that I can have a variable 1-30 and then it'll pull the image from the scene and that frame number.

I don't have each cell as it's own object, I'm hoping I can just pull directly from the scene. If I can't, then I could make each piece of the animation its own object, but I still wouldn't know how to make it pull dependent on the number I come up with. Can I pull data from another scene, or do I have to make the whole thing a movie clip? And how would I go about doing this whole thing?

I hope I'm clear enough in what I'm looking for. Let me know if you need more info, thanks I look forward to your replies!

[CS3] AS2 - Use Variable As A Symbol Name?
Hi All,

I'm not sure if what i'm trying to do is possible so I do apologise if it sounds like total madness!

I have 6 items in an array which get reordered, the first 3 being the "correct" items each time.

What i'm trying to do is make the corresponding item you click on disappear if it's a correct item, so at the moment I have the following:

moveitem = "item";
Each item is named item1, item2 etc so i've definied this as the generic value of the variable.

moveitem = (moveitem +(item[1]));
This code is applied once the item is clicked and deemed correct, and adds the number from the array to the end of the variable to make it match the symbol name i'm trying to move.

Now what I don't know how to do is get the data in this variable to refer to a symbol name on the stage, any help would be massively appreciated!

How Do You Pull The Movie Name From The Object/embed Code?
How do you pull the movie name from the object/embed code?

chilled

Pull Down Menu Imported From Main Movie
I made a pull down menu in flash MX. It works fine as an independent movie or attached on html page. However, when I imported from another .fla movie it works on its one, so I can not control it. The swf file does not have any mistake or bug , its clean and workfull.
It is there any actionscrip to fix this problem and where do I add it?
Pepe

Hyphen Symbol In Variable?
I am trying to pass a variable, but I can not get it to work.


Code:
value = 1-2;
trace(value);


I want it to trace 1 (dash) 2, not 1 (minus) 2. I know this is simple, but can i get some hints.

Also, the source of the varibles is going to come from a external text file, I don't know if that makes a difference.

Thanks

Searching A Variable For A Symbol
Hi everybody

I'm trying to search a textbox for certain characters that if they are present, the user is prompted to remove them, before the form can be submitted.

I can successfully check for one character at a time but instead of writing 15 if statements, i want to pack it all in one if statement, and just separate it with the logical OR operator. But, for some reason it's not working. Even when none of the characters are in the text box, it still acts like there are. here's my line of code, or part of it:


Code:
} else if (linkVar.text.indexOf(""") == -1 || linkVar.text.indexOf("/") == -1 || linkVar.text.indexOf(":") == -1 || linkVar.text.indexOf("*") == -1 || linkVar.text.indexOf("?") == -1 || linkVar.text.indexOf(""") == -1 || linkVar.text.indexOf("<") == -1 || linkVar.text.indexOf(">") == -1 || linkVar.text.indexOf("|") == -1) {
trace("Filename can't include these characters: /, , :, *, ?, ", <, >, or |.");
Selection.setFocus(linkVar);


If anyone can help, I love them.

thanks

Symbol Path And Name From Variable
Hello
Imagine that I have a dynamic textbox named textbox1 inside a movie symbol named main placed at root level.

To change the textbox text I would do this:

PHP Code:



_root.main.textbox1.text = "My text" 




If I got the symbol name from a variable I would do this:

PHP Code:



Var SymbolVariable = "textbox1"
_root.main[SymbolVariable].text = "My text" 




But what if I got both symbol name and symbol path from variables?
I tried this way but it doesn’t work

PHP Code:



Var SymbolPathAndName = "main.textbox1"
_root[SymbolPathAndName].text = "My text" 




Can someone show me a way to make this work?

Thanks

Find Instance Of Symbol Using Variable
hi, can anyone help me with this?

I need to find an instance of a symbol on the stage uding actionscript, but I don't know the intance name. The instance name is contained in a variable.

clpMovie1.varName._property doesn't work

so can anyone tell me if there's anyway I can do this?

thanks

[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!

Help Cant Pull Dynamic Links From A Text File Using Duplicated Movie Clips
I am trying to create a way to easily update a section of a website. I can dynamically pull image using an array from an external text file and load them with loadmovie, but i can not add any kind of onrelease to make them link dynamically. I'm kinda new to flash but I can't figure it out. I have included the filez I was working on.

How To Control A Movie Symbol In A Movie Which Is Loaded Intro Another Movie?
HI guys,
I need help with some script. I have a movie, which is my main movie, and to which I load all other movies, like sound clips, other related movie which load on request. the problem is with the sound movie which I created, it's a separate file and it has a sound loop which starts and then if an button is clicked it stops, and then starts again if the buttons is pressed again. Also in this sound movie I have another movie symbol with audio bars animation which plays only when the sound is playing, and then it stops when the sound is stopped. It works fine with this code:

on (release) {
if (i==1) {
s.start(0,999);
i = i*(-1);
tellTarget ("/sound_bars") {
gotoAndPlay (1);
}
} else {
s.stop();
i = i*(-1);
tellTarget ("/sound_bars") {
gotoAndPlay (10);
}
}
}

...on it's own, but when it is loaded into another movie it works only partially, the sound stopps but the audio bar animation which you see here as instance name "sound_bars" is not working, it keeps playing even when the button is pressed. but like I said the sound stopps. So what I need to know is how to control that movie symbol which is inside a movie called soundloop1, which is loaded into my main movie. I know it's a level / tell target issue, but I just cannot figure out how to control it from another movie. If you can help me that would be greatly appreciated Thanks.

--
elfe.

Converting Existing Movie Into Movie Symbol
Is there any way I can convert an existing Flash 5 movie (one with several layers) into a movie clip?

I have tried using Copy Frames but if i select frames from more than one layer I cant do this as Copy Frames is greyed out. If I select all frames, I can Cut Frames but then I cant seem to paste them into a symbol.


Is there any way to do this? Do I need to copy and paste each layer seperately?

Help much appreciated...

Sonia

FPS Of A Movie Symbol?
Is it possible to change the fps (frames per second)of a movie SYMBOL without it affecting the fps of the MAIN movie? If so, how? Thanks.
[Edited by ZipTriX on 05-03-2002 at 04:06 PM]

Can't Get Out Of Movie Symbol
Hi

I am very new with flash and will just give you the run-down on my problem...

On the first scene, frame 1, I have made actionscripted it to stop, and I have two buttons. When clicked on one, it takes you to Scene 2


On the second scene, first frame I have made a video symbol, which automatically plays in "test movie" when you get to scene 2. At the end of the movie, I have two buttons, "again" and "back"...

The problem is that although "again" works fine when I tell it to go back to frame 1, I have also autoscripted "back" to go back to Scene 1. There are no syntax errors, but for some reason, when I click it, I am taken back to the start of my movie and it holds there...

Any help would be appreciated

Thanks

Value Within Movie Symbol
When I need a value to carry through to all levels of flash I would use this /:
for example if I was to have this actionscript within a movie symbol:
/:testword = "it's working";
the value of testword will equal "it's working" on all levels of the flash movie.

Now this works when the movie is played in AS1 but not AS2. When played in AS2 it will give an error in the output box.

So whats the equivelent of /: in AS2?

Movie Symbol
I have an FLA that contains in it a movie symbol.

This movie symbol uses an external text file to scroll some text.

So created the scrolling movie , then drug it's symbol to the stage within the parent movie.

But I get no scroll.

The scroll movie contains 2 frames. The parent one (but I have a "stop" action in frame one of the parent.)

The scroll movie DOES work by itself as a separate FLA altogether. It's once I copy and paste into the Parent movie that things go awry.

Any help would be greatly appreciated. I'm working in MX2004.

Movie Symbol
Hi

I have a movie symbol called "dot" of a pulsating dot, but no i would like it to stop after x amount of loops/repeats of the movie symbol.

How can i do this?

Thanks

Movie Symbol
Hi

I have a movie symbol called "dot" of a pulsating dot, but no i would like it to stop after x amount of loops/repeats of the movie symbol.

How can i do this?

Thanks

Save Movie As Symbol?
How do I save a animation as a movie symbol?
Thanks for your help in advance.

How Do I Make My Whole Movie Into A Symbol?
How do I make my whole movie into a symbol? I want to use it in another movie so it only takes up one frame. Kinda how a symbol is use on the main stage.
Thanks

Movie Symbol... In A Scene
Well...

I created a movie symbol that fades in and out a bunch of graphic symbols. Then I draged it in to my scene, but it does not cycle through the items I put in the movie symbol...

any help?

Thanks so much!

Controlling The Movie, With A Symbol.
Hey, I'll get straight to the point. I created a Menu entirely in a movie clip. After the menu is done requesting the information from the user, I wanted a button in the Movie Clip to make the main Movie go to the next scene. How do you do this? Can it even be done?

[Some Info]
version- Flash MX
Menu Instance - "menu"
button instance - "nxtscene"

If you can help i'd be much appriceated!

-FViral

GotoAndPlay In Movie Symbol
Ok, now what I am trying to do it... I have a button inside of a movie clip. And when that button is pressed I want frame 3 of the scene that the movie clip is played on to be played. So I use gotoAndPlay("Main",3). However this didn't work. It didn't go to any frame. So I have 3 scenes... I moved the scene Main before the scene Opening. Opening in which I want to play first. So on the first frame of Main where I set my variables and such I say gotoAndPlay("Opening",1) and then when opening is done it just jumps right into the second frame of Main. So then in my movie symbol code I stated _root.gotoAndPlay(3) amd this worked great. When I previewed in Flash everything works great. But then when I published it, it didn't work... the scene opening didn't play, and the action script on my scene main didn't work, although the graphics on Main were displayed. If I put Opening first then it will play through right... but then when I do the _root.gotoAndPlay(3)... it doesn't work because it will play the 3rd frame from opening... and if I say _root.gotoAndPlay("Main",3) then it won't go to any frame as if I just say gotoAndPlay. What's going on?

-paco.

Swapping A Movie Symbol?
When i click my button, i want (using actionscript) image1_mc to change to image2_mc, when clicked again image2_mc to swap back to image1_mc... and so on

any ideas on this code pleeeeease?

Moving A Symbol To A New Movie?
is there away to move a symbol from my main.fla into the secondary.fla? heres what i mean i have a server pic thats all cut out and perfect. now i need to make a smaller version for an ad of the thing but i lost the original image due to a hard drive burn. so is there a way to save it to the common libraries or anything???? if i try to save it adds a black bg to it which unfortuantely the server is dark almost black so i get mad jaggies. so i need the actual symbol. i know a work aroudn but its gonna be a pain in the ass. any ideas besides saving the whole movie as something else then making the changes i need? so i can move symbols through flash into a new movie?

Movie Symbol Repeat
I do a lot of 3D quicktimes and bring into FLASH MX. I want to be able to have a clip play several times (loop) before going elsewhere in the project, how could I do this, I am not the greatest at actionscripting, but am getting better.

Thanks

Stop Movie From A Symbol
Hello!
I made a preloader in a symbol. I also inserted the preloader symbol in the main movie. Now, I would like to know what is the code to stop the main movie from the symbol and what is the code to continue playing?

Best Regards
George Mercury

Help Help Help How Do You Get A Movie Symbol Never To Repeat?
Hi! Is there an actionscripting solution to removing a movie script symbol once it's played once?

Thanks!
Scout

Load Movie Into A Symbol
I've created a flash file with a TV in it.. and I need to load a movie into that same flash file, and also be able to move that movie around. I'm pretty sure you can load movies into symbols, and then do whatever you want with them... I just forgot how to do that.

Moving A Movie Symbol
I am trying to get an object to move to the button that the user is currently over. I have the movie symbol moving and I can get it to move up and down. But when its over 2 buttons, its exposed and I need to move it horizontally so the movie is not out in the open. I can only get it to move diagonally left or right. All I need is to be able to move it to the left for two buttons.

Here is what I have in the scene 1 frame:
stop () ;
//function that makes the movie move
//move () makes it move smoothly, move2 () makes it move with an elastic effect
MovieClip.prototype.move2 = function () {
desty = _root.ynew ;
destx = _root.xnew ;
posy = this._y ;
posx = this._x ;
vel = vel*0.7 + (desty-posy+destx-posx)/7 ;
this._y += vel ;
this._x += vel ;
}
MovieClip.prototype.move = function () {
desty = _root.ynew ;
destx = _root.xnew ;
posy = this._y ;
posx = this._x ;
vel = (desty-posy+destx-posx)/7 ;
this._y += vel ;
this._x += vel ;
}

Here is whats in the movie clip:
//This sets the position of the clip when you start
onClipEvent (load) {
_root.ynew = _y + (4-1)*100/2 ;
_root.xnew = _x + (4-1)*100/2 ;
}
//Pretty much obvious. The destination is controlled by the small clip. That little
//clip is made out of invisible buttons that give a destination interpreted by the
//function move ()
onClipEvent (enterFrame) {
move () ;
}

Here is whats in a invisible button:
//sets the destination
on (rollover) {
_root.ynew =_y-(1+1)*100/2;
_root.xnew = 0;
}
Any help would be appreciated! Thanks

Movie Clip Symbol
You know when you place a movie clip symbol on the stage, the first frame is shown by default. Is there any way to display other frames by default, such as the last frame? I'm talking about the FLA, not the SWF.

Symbol Movie Clip
i open a new document and make a motion tween. is there a way to turn that into a symbol movie clip?

Calling A Movie Symbol
Hi everyone.
My question is simple:
How do i call a movie symbol from a button or graphic within my movie?

When i click that graphic (or button) i want it to take me to a movie symbol i have in my library.

What kind of actionscript do i need?

I'm using Flash mx 2004.

Thanks.

Can't Seem To Convert To Symbol Movie
Hello,

I have a few layers that I cannot seem to convert to a movie. I am putting together a button that shines when you mouse over it. I am successful in creating the masked mouseover "shine" adn everything (it tests perfectly) but I want to be able to use it as a Symbol.

Here's what's happening: I am selecting all the layers then going to "Convert to Symbol" then I name, give it a Behavior of Movie Clip, registration top-left, then click OK. It shows in the library but when I try to test it in the library, it doesn't work like other movies do. There's no little Play and Stop buttons like with other movies that ohter people made. If I drag it to the stage it doesn't work and neither does my original "non-symbol" button.

Thanks for the help!

Copyright © 2005-08 www.BigResource.com, All rights reserved