Solved

Launch a JavaScript function from Flash (AS3)

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now