?
Solved

Launch a JavaScript function from Flash (AS3)

Posted on 2009-05-11
4
Medium Priority
?
1,036 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 2000 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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
Suggested Courses

777 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