Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 06-29-2012, 02:29 PM   #1
Registered User
Join Date: Jun 2012
Posts: 4
Unhappy Passing Variables From Javascript to AS3

Hey, new here and in a major bind. I need to pass a variable back to flash from my Javascript. The variable will change which video is being playing in the .swf by click on the link.

<a href="javascript:void(0);" onClick="swapVideo();" ><i>Video</i></a>

var flashVidSource;
flashVidSource = 'video1';

//swapVideo when bio is clicked
function swapVideo(str)
//point to flashVideo player
getFlashMovie("introPlayer.swf").sendToActionscrip t(str);
//check conditional value
if(flashVidSource == 'video1')
//toggle from video1 to video2
flashVidSource = 'video2';
//toggle from video2 to video1
flashVidSource = 'video1';
//pass the string to introPlayer.swf

import flash.external.ExternalInterface;
//listen for javaScript
ExternalInterface.addCallback("swapVideo", swapVideo);

//set the intial source of videoMc by calling the function and pushing the string

function swapVideo(str):void
//depending on the string passed from JavaScript, display correct video
if (str == "video1")
//aiello's path
videoMc.source = "video1.flv";
//video2 if (str == "video2")
//video2's path
videoMc.source = "video2.flv";

It is not working, PLEASE HELP!

Last edited by developerSpy; 06-29-2012 at 03:29 PM.
developerSpy is offline   Reply With Quote
Old 06-30-2012, 04:15 AM   #2
Join Date: Jul 2011
Location: Layton City, Utah
Posts: 193

This kind of seems similar to what you are trying to accomplish:

USAFDrew2011 is offline   Reply With Quote

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 On
HTML code is Off

Forum Jump

All times are GMT. The time now is 07:10 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.