Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Extensions and Plugins > Components

Reply
 
Thread Tools Rate Thread Display Modes
Old 11-01-2004, 04:45 AM   #1
millmoss
Registered User
 
Join Date: Nov 2004
Location: Davis, CA
Posts: 2
Send a message via AIM to millmoss Send a message via MSN to millmoss Send a message via Yahoo to millmoss
Default Global Variables (I know, jeez), ScrollPane, and 1 measly button.

Good Lord, I went through every thread on global variables on this site. I do understand how global variables are set, and I understand that to update a global variable, you need to use the _global. For some ungodly reason, my variables are behaving badly, and while the file I am using this in is huge, I made a small manageable sample for you guys to look at. This is for an elearning software simulation.

The specifics:

1. I have a form which resides in a scroll pane.

2. Those fields in the form will need to be stored as global variables.

3. The only way I've been able to pass anything at all, is to define the input fields in the forms as _root.whatever. This is in the variable field rather than the instance name.

4. When the user clicks the submit button, my goal was to have all of the _root variables entered in the form go to _global so that I could access them in other nested movie clips. In the sample, this is passing the _root.citationName to the _global value of cName.

5. The trace on cName says that it's set up properly. Doesn't seem to be working though.

Thanks in advance for any light you can shine on my current darkness.

Jeremy
Attached Files
File Type: zip jtest.zip (64.1 KB, 239 views)
millmoss is offline   Reply With Quote
Old 11-01-2004, 08:25 AM   #2
emergency_pants
Today I smell of toast
 
Join Date: Dec 2002
Location: London, UK
Posts: 1,053
Default

I don't see anything wrong with the function accessing the _global or the button accessing the _global function. The trace displays the scrollpane text fine! Which suggests its a problem with the textfields.

The problem with your textfields not showing the variable is that they do not have the correct variable entered in the properties box.

I suggest not using the properties box for displaying variable dynamic text in your textfields. I tend to avoid it exactly because of the problem you are having. Instead, try naming your textfields and assigning the text to them instead. It makes for a few more lines of script, but it does mean that all your dynamic text assignments are explicitly placed inside your code, instead of hiding inside textfield property boxes.

ActionScript Code:
//initialize the variable _global.cName_str; //function for the button to make the global variable equal to the root _global.myclick = function() {     _global.cName = _root.citationName;     trace(_global.cName);     //display the text in the textfields     //NB:  Make sure the textfield instances are named     txtInRoot.text = _global.cName;     home.txtInClip.text = _global.cName;     //  trace(_root.citationName); }; stop();

I hope that helps.
Attached Files
File Type: zip jtest2.zip (64.3 KB, 239 views)
__________________
Cheers,

Simon.

Last edited by emergency_pants; 11-01-2004 at 08:29 AM.
emergency_pants is offline   Reply With Quote
Old 11-01-2004, 01:46 PM   #3
millmoss
Registered User
 
Join Date: Nov 2004
Location: Davis, CA
Posts: 2
Send a message via AIM to millmoss Send a message via MSN to millmoss Send a message via Yahoo to millmoss
Default Thanks Simon!

So at least I know that I'm not crazy now. Thanks a ton Simon! Doesn't it seem like that properties box should work like that? Or am I just not thinking about it the right way. Regardless, with all the questions on this message board, it seems like someone at Macromedia needed to take just a few more paragraphs in the documentation.

Anyway, I really, really appreciate the help.

Jeremy
millmoss is offline   Reply With Quote
Old 11-01-2004, 02:06 PM   #4
emergency_pants
Today I smell of toast
 
Join Date: Dec 2002
Location: London, UK
Posts: 1,053
Default

yeah.. the var: box in the properties window IS supposed to work like that, so you weren't wrong in assuming the text should show. Except that sometimes I find that the variable text doesn't show Especially if the variable is not on the same timeline as the textfield or if it's a _global variable. It seems to be inflexible & best avoided unless its a simple movie and you want to save some time

Glad it helped, anyway.
__________________
Cheers,

Simon.
emergency_pants is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:48 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.