?
Solved

Flash variable to javascript URGENT!!!!!!

Posted on 2011-03-03
6
Medium Priority
?
192 Views
Last Modified: 2012-05-11
I'm using this to send my flash variables to javascript:

signup_btn.onRelease = function()
{
	my_vars = new LoadVars();
	my_vars.username = pogu_username_1.text;
	my_vars.pword = pogu_pword_1.text;
	my_vars.gname = pogu_gname_1.text;
	my_vars.lname = pogu_lname_1.text;
	my_vars.gender = pogu_gender_1.text;
	my_vars.contactno = pogu_contactno_1.text;
	my_vars.email = pogu_email_1.text;
	my_vars.dob = pogu_dob_1.text;
	my_vars.addres = pogu_address_1.text;
	my_vars.difficulties = pogu_message_1.text;
	
	
	getURL ("Javascript:submitregdata('my_vars')");
	
	//trace(my_vars);
};

Open in new window


However my javascript function is returning the variables as undefined. Any ideas?
0
Comment
Question by:brettacvh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 16

Accepted Solution

by:
sjklein42 earned 2000 total points
ID: 35033602
I use ExternalInterface rather than getURL.

http://www.actionscript.org/resources/articles/638/1/Basics-of-using-the-ExternalInterface/Page1.html

Looks like this to call myJavascriptFunction from FLASH:
:
flash.external.ExternalInterface.call("myJavascriptFunction", arg1, arg2);

Open in new window

0
 

Author Comment

by:brettacvh
ID: 35033639
Is that relevant for AS2?
0
 
LVL 16

Expert Comment

by:sjklein42
ID: 35033653
Absolutely.  I'm still stuck back in the dark ages with AS2 myself.  :)
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 16

Assisted Solution

by:sjklein42
sjklein42 earned 2000 total points
ID: 35033654
You need to include this header line:

import flash.external.ExternalInterface

Open in new window

0
 

Author Comment

by:brettacvh
ID: 35033672
Actually what seems to be working now is with  the '+' concatenation:

signup_btn.onRelease = function()
{
	my_vars = new LoadVars();
	my_vars.username = pogu_username_1.text;
	my_vars.pword = pogu_pword_1.text;
	my_vars.gname = pogu_gname_1.text;
	my_vars.lname = pogu_lname_1.text;
	my_vars.gender = pogu_gender_1.text;
	my_vars.contactno = pogu_contactno_1.text;
	my_vars.email = pogu_email_1.text;
	my_vars.dob = pogu_dob_1.text;
	my_vars.addres = pogu_address_1.text;
	my_vars.difficutlies = pogu_difficulties_1.text;





	getURL("Javascript:submitregdata('" + my_vars.username + "','" + my_vars.pword + "','" + my_vars.gname + "','" + my_vars.lname + "','" + my_vars.gender + "','" + my_vars.contactno + "','" + my_vars.email + "','" + my_vars.dob + "','" + my_vars.addres + "','" + my_vars.difficutlies + "')");

//trace(my_vars.difficutlies);
};

Open in new window

0
 
LVL 16

Expert Comment

by:sjklein42
ID: 35033712
What does the code for the Javascript function look like?  (The function we are calling)

We need to make the arguments on the FLASH side match the Javascript.  We may need to adjust code on both the FLASH and the Javascript to make it work easily.  Are you able to change the Javascript, or is that code already done?

Please post (at least) the Javascript source code for the submitregdata function so I can see it.

Thank you.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question