Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

pass variable between 2 pages using AS3

New Here ,
Feb 24, 2011 Feb 24, 2011

Hello, i have some web page (on webserver) that including swf file, after clicking on the swf section its redirect to another page that including different swf file. how can i pass variable from the first swf to the other one? any idea???

TOPICS
ActionScript
535
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 24, 2011 Feb 24, 2011

in your first swf use something like that as the link for the second swf:

http://mySwf2.html?parameter1=val1

and in your second html file use

Javascript to get parameter1 with :

val1= window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');

and then use SwfObject to embed ypur swf in the html

<script language='JavaScript'>

var variables={};

variables.val1='" + val1 + "';swfobject.embedSWF('mySwf2.swf', 'swf2', '800', '300', '9.0.0', 'expressInstall.swf',variables);

</script>";

the in your myswf2.swf :

var par1:String=LoaderInfo(this.loaderInfo).parameters.parameter1;

note: it's not a working code, you have to change/edit/add as your needs.

Message was edited by: Hakan KIRIK

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 24, 2011 Feb 24, 2011
LATEST

One way is to use a query string.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines