;

PDA

Click to See Complete Forum and Search --> : "Variable" Help please


MoonRise
08-26-2005, 04:59 PM
Are variables that are defined in the Parent (root) movie inheritable down to the child movie. IE ButtonPushed = False (or True) is defined in Parent (root). Child movie has "if(ButtonPushed){ code here}

Please let me know if I'm on the right path.

Thanks!

blanius
08-26-2005, 05:28 PM
Are variables that are defined in the Parent (root) movie inheritable down to the child movie. IE ButtonPushed = False (or True) is defined in Parent (root). Child movie has "if(ButtonPushed){ code here}

Please let me know if I'm on the right path.

Thanks!

The answer is yes, when referencing between movies you just have to append the movie it's in..

in the child movie you'd refer to the variable as parent.myvariable or if you are sure the movie is not loaded into another one you can use root. to refer to a variable in a child movie append the child movie name ie.

mychild.variablename

here's where it gets tricky though if you want to get the same variable from another child movie you append parent to that to get

parent.mychild.variablename

MoonRise
08-26-2005, 10:47 PM
The answer is yes, when referencing between movies you just have to append the movie it's in..

in the child movie you'd refer to the variable as parent.myvariable or if you are sure the movie is not loaded into another one you can use root. to refer to a variable in a child movie append the child movie name ie.

mychild.variablename

here's where it gets tricky though if you want to get the same variable from another child movie you append parent to that to get

parent.mychild.variablename


BLanius,

Thanks a bunch. I thought I wasn't crazy on that. I also learned NOT to set a variable through a button click. That didn't work for some reason. I did find a way to let the resulting screen from the button click to set the variable and everything else feel into place. Now, I need to set another variable in that child movie back to zero, but from the root. This is the error I get:
"Cannot assign property 'mycntr' to undefined variable on line 2 DedicationType.mycntr=0"

"DedicationType" is the child movie, and "mycntr" is the variable inside that child movie. I can think of another way to make it work. I just want to understand a little more about variable passing. Did I follow you correctly on the Child Movie variable? The "root" part worked great! Thanks for your help.

blanius
08-27-2005, 04:18 PM
where is the code trying to set DedicationType? try changing to root.DedicationType.mycntr

blanius
08-27-2005, 04:30 PM
From the help file

A movie element will have its own set of variables, independent of the variables in the parent movie. The value of each variable will persist, even when the movie stops or loops.

Objects in flash do not have a center position, and they do not have velocity or
acceleration. 3D Flash Animator makes these features available by exporting two flash objects for each movie element. The first flash object controls the position and velocity,and the second flash object controls the center.The second object also contains the frames of the movie element.

When you use a script to control the position of movie element, or to show or hide the element,then you should use the 'element' function to get a handle to the first flash object.

element("my child movie").x = 100;
element("my child movie").y = 100;
element("my child movie").show();


But when you are using a script to control the playing of frames, such as playing or stopping a movie element, then you must use the "movie" property to get a handle to the second object.
element("my child movie").movie.stop();
You must also use the "movie" property to gain access to the variables of the movie element.

element("my child movie").movie.variable_name = "value";

Main movie

The main movie is available from any script using the variable 'root'.
You can access any of the main movie's variables, or control the frames of the main movie.


root.variable_name = "value";
root.play();

MoonRise
08-27-2005, 05:31 PM
Thanks! I didn't listen to my own advice - READ THE HELP FILES!. Oh well. I've been able to complete a good majority of what I'm working on. Since you've been so good at helping:

Home Site (http://home.bellsouth.net/p/s/community.dll?ep=16&ext=1&groupid=278930&ck=)

It will give an Adult Warning page first, but what I'm working on isn't that bad. Maybe some language like *ss.

There will be a Menu bar above that is a part of the Host system. Click on Hide Menu for best view. Also 1024 X 768 screen.

Also, Click on TAKO INFORMATION when the button appears. This will lead you to where I have the variables. You may recognize some of it. It is from my older site and it is with the Typewriter sound that I was working on 8 months back (maybe a lot longer).
:)

blanius
08-28-2005, 09:56 AM
Dude I was going to look at it but couldn't sit through that LONGGGGGGG intro again. If you MUST have a painfully long intro the least you could do is give the option to skip it.


NOOOOOOOO Oh man I went back and waited it out then tried to get back to your menu and the intro ran again AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH!!!! ! not again.

You gotta fix that if you expect anyone to ever see the inside of your site and want them to ever come back to your site.

MoonRise
08-28-2005, 10:30 AM
Dude I was going to look at it but couldn't sit through that LONGGGGGGG intro again. If you MUST have a painfully long intro the least you could do is give the option to skip it.


NOOOOOOOO Oh man I went back and waited it out then tried to get back to your menu and the intro ran again AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH!!!! ! not again.

You gotta fix that if you expect anyone to ever see the inside of your site and want them to ever come back to your site.

Thanks for the feed back. I'll look into a "Skip Intro" feature. Maybe move the "Replay Into" button to limit the "accidental" rplay of it. :) Funny though. I get a lot of "Wow that was great!", but then again that is usually family. :)

MoonRise
08-28-2005, 11:24 AM
Dude I was going to look at it but couldn't sit through that LONGGGGGGG intro again. If you MUST have a painfully long intro the least you could do is give the option to skip it.


NOOOOOOOO Oh man I went back and waited it out then tried to get back to your menu and the intro ran again AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH!!!! ! not again.

You gotta fix that if you expect anyone to ever see the inside of your site and want them to ever come back to your site.

OK. That took some time. Thought it would be easier than that. SKIP INTO is now a feature. Thanks! Want people to get to what they want a little quicker. The "Tako Infomation" is still the same though. There is a reason why I "force" some one to sit through that a while before giving the option to quit, I don't own that "Intellectual Property" and feel obligated to give that company "time". Any way, BLAnius, thanks for the input and help.