Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Launch a JavaScript function from Flash (AS3)

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

Understanding Web Applications

Without even knowing it, most of us are using web applications on a daily basis. Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We often confuse these web applications tools for websites.  So, what is the difference?

Question has a verified solution.

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

There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses

596 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