Solved

Launch a JavaScript function from Flash (AS3)

Posted on 2009-05-11
4
1,031 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
[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
  • 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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
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.

729 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