5 Replies - 538 Views - Last Post: 02 September 2010 - 01:58 PM

#1 FliP1992  Icon User is offline

  • D.I.C Head

Reputation: 14
  • View blog
  • Posts: 200
  • Joined: 14-June 07

Passing Varaibles

Posted 02 September 2010 - 06:45 AM

I have done a bit of AS2 and have just started playing around with AS3. I have a PHP script that handles the commutation between the Flash and Mysql database. On a error for example if a record is not found or database fails to connect an error message gets sent to the flash file, all this is working fine which is a miracle since im struggling with AS3

The only problem that i cant get my head around is how to communicate between my AS on frame1 and a dynamic text box inside of a movie clip or code inside of a movieclip.

I have tryed to use MovieClip which i thought would work but that failed and have also tryed just commincating straight to the dynamic textbox but this hasnt worked either.
function errorcheck(e:TimerEvent):void
{
	if(errorhandler!="None")
	{	
		LockScreen.visible=true;
		errorMessageBox.text = errorhandler;
        //MovieClip(mc_LockScreen).errorMessageBox.text = errorhandler;
		counter.stop();
		trace("Error Found");
	}
	else
	{
		trace("No Errors Found");
	}
}


Thanks,
Tom

Is This A Good Question/Topic? 0
  • +

Replies To: Passing Varaibles

#2 nick2price  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 561
  • View blog
  • Posts: 2,826
  • Joined: 23-November 07

Re: Passing Varaibles

Posted 02 September 2010 - 09:18 AM

Well, start of from the beginning. What instance name did you give your text field? Then simply try
YourInstanceName.text = "TESTING";


See if that works.
Was This Post Helpful? 0
  • +
  • -

#3 FliP1992  Icon User is offline

  • D.I.C Head

Reputation: 14
  • View blog
  • Posts: 200
  • Joined: 14-June 07

Re: Passing Varaibles

Posted 02 September 2010 - 09:52 AM

View Postnick2price, on 02 September 2010 - 03:18 PM, said:

Well, start of from the beginning. What instance name did you give your text field? Then simply try
YourInstanceName.text = "TESTING";


See if that works.

It has a instance name of "errorMessageBox" as can be seen in the code that i posted before but it comes up with a compiler error "1120: Access of undefined property errorMessageBox.".

This post has been edited by FliP1992: 02 September 2010 - 09:53 AM

Was This Post Helpful? 0
  • +
  • -

#4 nick2price  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 561
  • View blog
  • Posts: 2,826
  • Joined: 23-November 07

Re: Passing Varaibles

Posted 02 September 2010 - 11:47 AM

Firstly, double check the spelling. Next, is the textfield created in the same frame number as your ActionScript code? I know your AS in in frame 1, is that where your text field is? Give a little more info about your set up.
Was This Post Helpful? 0
  • +
  • -

#5 FliP1992  Icon User is offline

  • D.I.C Head

Reputation: 14
  • View blog
  • Posts: 200
  • Joined: 14-June 07

Re: Passing Varaibles

Posted 02 September 2010 - 01:43 PM

Yes the spelling is fine,"AS on frame1 and a dynamic text box inside of a movie clip" Yes the AS is on the same frame apart from the dynamic text box is inside of a movie clip on frame 1.

My question was how do i set the text box inside of a movie clip from the AS code on frame 1 of the root?

Thanks,
Tom
Was This Post Helpful? 0
  • +
  • -

#6 nick2price  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 561
  • View blog
  • Posts: 2,826
  • Joined: 23-November 07

Re: Passing Varaibles

Posted 02 September 2010 - 01:58 PM

Ok, try this
MovieClip(root).errorMessageBox.text = "TESTING";


or

MovieClip(parent).errorMessageBox.text = "TESTING";


I am just a bit confused as to what you mean inside of a MovieClip. Did you convert it to a symbol and set its type as a MovieClip, or did you code the TextBox extending a type MovieClip?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1