Solved

Launch a JavaScript function from Flash (AS3)

Posted on 2009-05-11
4
1,028 Views
Last Modified: 2012-08-13
Hello,
I am trying to launch Lightwindow from a button inside of Flash.

Here's the link in html:

<a href="flash/lightwindowFile.swf?scale=noscale" class="lightwindow page-options" params="lightwindow_width=808,lightwindow_height=450" >Lightwindow Link</a>

How do I launch a link with a class value and parameters?

Thanks in advance,
0
Comment
Question by:tmbdesign
  • 2
4 Comments
 
LVL 13

Expert Comment

by:qwerty021600
ID: 24361081
Check these URL's
http://www.permadi.com/tutorial/flashcalljs/index.html

maybe of help..
0
 
LVL 4

Accepted Solution

by:
manavsi earned 500 total points
ID: 24361087
To launch such type of scripts you cant do it in LightBox, use greyBox instead and use the javascript functionality of GB...

in your flash.. write code like... below in ur timeline..
goto("javascript:GB_show(caption, url, /*optional*/ height, width, callback_fn);");

OR

if you want to launch a flash file in lightbox... u cant do the same with LightBox again, for it may be used only for viewing the pictures.. Use GreyBox and follow its usage... to launch...

Greybox can be downloaded at: http://orangoo.com/labs/GreyBox/
0
 

Author Comment

by:tmbdesign
ID: 24376725
I am launching Flash content (a button in the sw on the page launches a lightbox with a different swf).

I downloaded and installed greybox and it looks like it should work.  I can launch the window with an html link.  

However, I am still strugling with how to launch it using the button in the swf (AS3) and couldn't find where this is addressed in the usage.

I read that javascript could be used to launch the window and the javascript could be called from Flash, but I don't know much about javascript and don't know how this would be done.

Could you please elaborate further on the process to get the greybox to launch from Flash?

Thanks.
0
 

Author Closing Comment

by:tmbdesign
ID: 31581091
I figured it out.

Greybox worked great.

In the page head:

<script type="text/javascript">
function openBox() {
GB_showCenter('TITLE','http://google.com, 600,
800);
}
</script>

And then in the Flash:

import flash.external.ExternalInterface;

function myFunction(event:MouseEvent):void {
      ExternalInterface.call("openBox()");      
}
myButton.addEventListener(MouseEvent.CLICK, myFunction);

Thank you so much!
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
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.

778 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