shadowbox from flash

classic Classic list List threaded Threaded
77 messages Options
1234
Reply | Threaded
Open this post in threaded view
|

shadowbox from flash

rakuen
Hi,

I followed direction from the FAQ about how to open shadowbox from flash.
http://www.mjijackson.com/shadowbox/doc/faq.html

However, I can't make it work...

Can anyone tell me how?
This is for AS2.0.


thank you.

Reply | Threaded
Open this post in threaded view
|

Re: shadowbox from flash

Wizzud
Could you please supply a bit more information about what you have tried, and how it "didn't work", otherwise it's a bit difficult to determine where you've gone astray!
Combine literacy with curiosity and a whole world of information opens up to you
Reply | Threaded
Open this post in threaded view
|

Re: shadowbox from flash

neocorps
In reply to this post by rakuen
Hi, i had the same problem.

  i've recently figured out how to doit, though im using AS3.0 that's why i had so much trouble. but here it is.

 In my AS3.0 i have:
------------------------------------------------
import flash.external.ExternalInterface;

button_btn.addEventListener(MouseEvent.CLICK, buttonfunction);

function buttonfunction(e:MouseEvent):void {
        ExternalInterface.call("openShadowbox",'yourURL','thePlayer','Title');
}

where:

  button_btn, is the instance of the button with which i want to open shadowbox
  buttonfunction, is the name of the new function im creating for the MouseEvent CLICK (here you can have MOUSE_OVER, and stuff like that).
  thePlayer, is what you want to open 'iframe' 'img' 'swf' etc..

----------------------------------------------------------
 For AS2.0 it would be like this:

import flash.external.ExternalInterface;

button_mc.onRelease = function() {
        ExternalInterface.call("openShadowbox",'yourURL','thePlayer','Title');
        //Or with getURL
        // getURL("javascript:openShadowbox('yourURL','thePlayer','Title');", "_self");
       
};


--------------------------------------------------------------------
  In my html i have:

   <html>

<script type="text/javascript" src="js/flashobject.js"></script>
   
<script type="text/javascript" src="shadowbox/jquery-1.2.6.js"></script><script type="text/javascript" src="shadowbox/adapter/shadowbox-jquery.js"></script><script type="text/javascript" src="shadowbox/shadowbox.js"></script>
<script type="text/javascript"> Shadowbox.loadSkin('classic', 'shadowbox/skin'); Shadowbox.loadLanguage('es', 'shadowbox/lang'); Shadowbox.loadPlayer(['flv', 'html', 'iframe', 'img', 'qt', 'swf', 'wmp'], 'shadowbox/player'); var openShadowbox = function(content, player, title){ Shadowbox.open({ content: content, player: player, title: title }); }; window.onload = Shadowbox.init; </script>
</head>
<body>



<div id="flashcontent1">
           
             
             
             
             
               
               
             

             
       

          </div>
      <script type="text/javascript"> var mymovie = new FlashObject("flash/myFlash.swf", "pelicula", "580", "444", "7", ""); mymovie.addParam("Header", "false"); mymovie.addParam("wmode", "transparency"); mymovie.addParam("allowScriptAccess", "always"); mymovie.write("flashcontent1"); </script>



</body>
</html>

--------------------------------------------------------------------------------------------

Its important that every flash you create you add the flash coding i give you, because it wont work if you dont use it. its also important to have the flashobject.js,and if you have more than one flash movie, you just add a number besides flashcontent, like so:

  <div id="flashcontent"> Flash 1</div>
  <div id="flashcontent1"> Flash 2</div>
  <div id="flashcontent2"> Flash 3</div>

and so on.

im uploading the flashobject.js file for you, because is very important that you have it, im also uploading a .rar file that i used when having your problem it helped me figure out how to do it.

hope this works for you!

shadowbox.zip , flashobject.js

if you can't open the files here is the link where i downloaded the shadowbox.rar:

http://www.kirupa.com/forum/showthread.php?t=305033

and here is the flashobject.js:

http://www.neocorps.com/js/flashobject.js

hope this all works for you because i had a rough time making it work for me.

cya. any questions just reply my post.
Reply | Threaded
Open this post in threaded view
|

Re: shadowbox from flash

rakuen
Thank you for your detailed explanation.
I tried your file which works perfectly.
However, when I switch to my flash file (AS2) it doesn't work...

Here is my actionscript in my test flash.
I have one mc (btn_mc) to open the test_image.jpg with the shadowbox.

------------------------------------
import flash.external.ExternalInterface;

btn_mc.onRelease = function() {
        ExternalInterface.call("openShadowbox",'images/test_image.jpg','img','Title');
};
------------------------------------

I locate my flash in the same folder as your sample html, used your html, added the test swf.
Your base.swf and my test.swf both load in the html. Your flash works, but when I click on mine, it does nothing...

I tried with getURL, but not working either.
I can't open your FLA file to see what I'm doing wrong, because I'm still using FLASH8.
I must be missing something in the action, though I don't see any error message.


After I posted this question originally, I gave up and used Lightbox++ to make the same effects since it was only jpg image to load. However, I really would like to use the Shadowbox because it allows me to open more than just image.

Any comments appreciated.
Reply | Threaded
Open this post in threaded view
|

Re: shadowbox from flash

neocorps
just to be in the same page,

i got from a webpage the shadowbox.rar file, so if you use it for testing, it wont work.

you should use the HTML that i wrote here in the forum alright?.

could you paste the HTML that you'r using?

because for what i can tell, the Actionscript 2.0 is Ok.
Reply | Threaded
Open this post in threaded view
|

Re: shadowbox from flash

rakuen
Here is the html.
All other links works with shadowbox but my swf.

--------------

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <title>Flash Shadowbox </title>
        <link href="inc/a.css" rel="stylesheet" type="text/css">
        <link rel="stylesheet" type="text/css" href="inc/shadowbox.css">
        <script type="text/javascript" src="inc/swfobject.js"></script>        <script type="text/javascript" src="inc/jquery.js"></script>        <script type="text/javascript" src="inc/shadowbox-jquery.js"></script>        <script type="text/javascript" src="inc/shadowbox.js"></script>        <script type="text/javascript"> $(document).ready(function(){ var options = { resizeLgImages: true, loadingImage: "images/loading.gif", displayNav: true, handleUnsupported: 'remove', keysClose: ['c', 27], // c or esc autoplayMovies: false }; Shadowbox.init(options); }); function abrirSB(type, title, url) { Shadowbox.init({skipSetup: true}); Shadowbox.open({type: type, title: title, content: url}); }; </script></head>
<body bgcolor="#ffffff">
<div id="main">
        <div id="sub">
                <div id="subart">
                        <div id="subheader">
                                <div class="subframe">
                                       

Flash ShadowBox

                                        <p>text link to the test image </p>
                                        <p></p>
                                        <center>
                                                <div id="flashcontent"></div>
                                                <p><br>
                                               
                                                <script type="text/javascript"><!-- var so = new SWFObject("test.swf", "test", "700", "500", "8", "#FFFFFF"); so.addParam("wmode", "window"); so.addParam("allowScriptAccess", "always"); so.write("flashcontent"); // --></script>                                               
                                                <div id="flashcontent2"></div>
                                                <p><br>
                                               
                                                <script type="text/javascript"><!-- var so = new SWFObject("base.swf", "test", "700", "500", "8", "#FFFFFF"); so.addParam("wmode", "window"); so.addParam("allowScriptAccess", "always"); so.write("flashcontent2"); // --></script>                                                </p>
                                        </center>
                                </div>
                        </div>
                </div>
        </div>
</div>
</html>
------------
Reply | Threaded
Open this post in threaded view
|

Re: shadowbox from flash

rakuen
In reply to this post by neocorps
After I poster the HTML, I realized I mixed up using which html.
So, here is what I have now. There are according to your html code posted here.
I still can't get it work...

I included text link in html which is working, but link from swf is not.
Thank you for your help.

-----------HTML------------

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
       
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>test</title>


                <script type="text/javascript" src="js/swfobject2/swfobject.js"></script>                <script type="text/javascript"> swfobject.registerObject("myFlashContent", "8.0.0"); </script>


<script type="text/javascript" src="js/jquery-1.2.6.min.js"></script><script type="text/javascript" src="js/shadowbox-jquery.js"></script><script type="text/javascript" src="js/shadowbox.js"></script>
<script type="text/javascript"> Shadowbox.loadSkin('classic', 'shadowbox/src/skin'); Shadowbox.loadLanguage('es', 'shadowbox/src/lang'); Shadowbox.loadPlayer(['flv', 'html', 'iframe', 'img', 'qt', 'swf', 'wmp'], 'shadowbox/src/player'); var openShadowbox = function(content, player, title){ Shadowbox.open({ content: content, player: player, title: title }); }; window.onload = function(){ Shadowbox.init(); }; </script> 


</head>

<body>
<div id="wrapper">

        <div id="container"> 
  text link 
                       
                               
                               
                               
                               
                               
                                       
                                       
                                               
                                               
                                               
                                               
                                       
                                       
                               

                               
                       

       
          </div>
</div>

</div>
</body>
</html>

--------------------------





-------------ActionScript-------------
import flash.external.ExternalInterface;

btn_mc.onRelease = function() {
       ExternalInterface.call("openShadowbox",'shadowbox/test.jpg','img','title');      
 };
--------------------------
Reply | Threaded
Open this post in threaded view
|

Re: shadowbox from flash

neocorps
hey man,

  if you would like to see a working example of the page so that you can see that it works just go to

 http://clientes.neocorps.com/metric/productos.php

  go to the flash animation at the bottom, and click one of the left buttons, and then click on one of the orange links.. it will open shadowbox.

  check the source code, so that you can see the difference betwen your code and mine.

  for what i can tell, is that you have my code mixed with the code from the shadowbox.rar archive that i sent to you.

  if you change myMovie.addparam to so.addparam, it will access to the js/swfobject2/swfobject.js file you got.. because my code uses a js/flashobject.swf file, and instead of using so.addparam, uses myMovie.addparam.

  I guess that that should work.. if it doesnt, just change that swfobject.js to my flashobject.swf.

  That's the only solution i can come up with without you sending me your swf and your html page and trying to make it work.

  sorry if this doesn't help you.. but if you're willing to spend a little more time with this, you could send me a link to download your documents and try to fix it.

  Cya
Reply | Threaded
Open this post in threaded view
|

Re: shadowbox from flash

rakuen
Hi neocorps,

Thank you for posting the link of your work. I see it works perfectly.
I tried your method but couldn't make it work...
However, I'm finally able to make it work with the other html.
It now works with swfobject2 which I use.

Thanks again your help. You encouraged me to search what was wrong, and eventually it worked!  

Since this was a big mistery to me, I'm posting the html and actionscript that works for me.

Rakuen

----------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>Flash Shadowbox </title>
        <script type="text/javascript" src="../js/swfobject2.js"></script>        <script type="text/javascript" src="../js/jquery.js"></script>        <script type="text/javascript" src="../js/shadowbox-jquery.js"></script>        <script type="text/javascript" src="../js/shadowbox.js"></script>       
        <script type="text/javascript"> $(document).ready(function(){ var options = { resizeLgImages: true, loadingImage: "images/loading.gif", displayNav: true, handleUnsupported: 'remove', keysClose: ['c', 27], // c or esc autoplayMovies: false }; Shadowbox.init(options); }); function openShadowbox(type, title, url) { Shadowbox.init({skipSetup: true}); Shadowbox.open({type: type, title: title, content: url}); }; </script></head>
<body>
<div id="wrapper">
       
        text link 

        <div id="container"> 
 
                       
                               
                               
                               
                               
                               
                                       
                                       
                                               
                                               
                                               
                                               
                                       
                                       
                               

                               
                       

</div>

</div>


</body>
</html>

---actionscript---

import flash.external.ExternalInterface;

btn_mc.onRelease = function() {
        ExternalInterface.call("openShadowbox",'swf','Title','../opening.swf');      
};

--------------------
Reply | Threaded
Open this post in threaded view
|

Re: shadowbox from flash

neocorps
You're wellcome,

  I had a tough time with this one too, that's why i wanted to post my solution here, cuz there's probably more people out there who has the same problem, and there's hardly any concrete solutions.

Cya.
Reply | Threaded
Open this post in threaded view
|

Re: shadowbox from flash

antonio
I've tried two ways but it didn't work.

I couldn't load an external page like...you have done in metric

Could you post your .fla?? or something to view how it's done??

Thanks a lot.
Reply | Threaded
Open this post in threaded view
|

Re: shadowbox from flash

neocorps
Hi antonio,

  I can't post the fla i did in metric, but im gonna post a file specifically so that you can view how its done in AS2 and AS3.

  i'll be posting tonight or something like that, because i have some work right now.

Reply | Threaded
Open this post in threaded view
|

Re: shadowbox from flash

neocorps
In reply to this post by antonio
antonio wrote
I've tried two ways but it didn't work.

I couldn't load an external page like...you have done in metric

Could you post your .fla?? or something to view how it's done??

Thanks a lot.
A promise is a debt, and here it is what i promised.

 This is a small self explainig tutorial to do what you want to do with shadowbox from a flash file.

 It has a working html file, and AS2 & AS3 fla files, so that you can see what is the script that makes everything work.

Hope this resolves any question.

Cya.

flash_shadowbox.rar
Reply | Threaded
Open this post in threaded view
|

Re: shadowbox from flash

antonio
Thank you very very much¡¡

It worksssssss

My mistake was in the flash call to the function openShadowbox. I put html type and it didn't work. With iframe type there's no problem.

Thanks a lot again¡¡

Ciaoooo
Reply | Threaded
Open this post in threaded view
|

Re: shadowbox from flash

neocorps
antonio wrote
Thank you very very much¡¡

It worksssssss

My mistake was in the flash call to the function openShadowbox. I put html type and it didn't work. With iframe type there's no problem.

Thanks a lot again¡¡

Ciaoooo
Hi antonio,

  Yes, that is a problem, at first i thought that the HTML player was used to display web pages, but that's wrong, it must be iframe.

  Glad to see that you fixed your problem!. you'r welcome.

ciao!
Reply | Threaded
Open this post in threaded view
|

Re: shadowbox from flash

Matz
Thx a lot Neocorps !!!
works so well !
Nice for your work.

A question : how can i realize an images gallery ?
in the AS2 flash ?

Another question: I would keep my swf visible under shadowbox, how can i do this ?

Thx again

Bye
Reply | Threaded
Open this post in threaded view
|

Re: shadowbox from flash

neocorps
Hey matz!

  Good to hear that my tutorial helped you, no im sorry i really dont know how to do an image gallery, i have not been in the position to need that from shadowbox.

  i was searching in this forum and i found this, maybe you can ask there how can it be done!.

http://n2.nabble.com/Loading-an-HTML-page-into-shadowbox-from-a-flash-button.-td1310727.html#a1310727

  Sorry i couldn't be much help, if you find out how please reply to this post, its never bad to know something more.

Cya!.

EDIT -------------------------------

I found this too, if you can mix it with my html, then you'r probably done!.

http://n2.nabble.com/Calling-gallery-from-JS-function-td1310103.html#a1310103

Reply | Threaded
Open this post in threaded view
|

Re: shadowbox from flash

Matz
Hi Neocorps,

i looked through the forum.
And I've got it !

- First, in scripts i did :

window.onload = function(){
  Shadowbox.init();
  Shadowbox.open(document.getElementById('id'));
};

and too :


function GroupDelegate(id) {
   var objLink = document.getElementById(id);
   Shadowbox.open(objLink);

- In flash i call my function GroupDelegate like that :

Btn01.onRelease = function() {
getURL("javascript:GroupDelegate('gallery');", "_self");
};

- In my Body HTML i call the first image by the id="gallery" with rel="shadowbox[...]"
and the second one with an id="gallery1", third one id="gallery2" ............


I'm happy caus i'm a newb :)
I tried with an iframe but i understand nothing at all  :)

Thanks to gave me the ways

Bye




Reply | Threaded
Open this post in threaded view
|

Re: shadowbox from flash

neocorps
 Im glad i could help matz!

 Im a little confused with what you said about the HTML

Matz wrote
- In my Body HTML i call the first image by the id="gallery" with rel="shadowbox[...]"
and the second one with an id="gallery1", third one id="gallery2" ............
 But i'll give it a try later and if i get it to work well i'll add that to my flash_shadowbox tutorial!.

  Thanx for posting back!.
Reply | Threaded
Open this post in threaded view
|

Re: shadowbox from flash

Matz
I used a Wizzud' explanation in this post :

http://n2.nabble.com/Galleries-and-shadowbox.open-method-from-SWF-td1310838.html#a1310838

And that works. (Thx Wizzud)

My last problems now are :
- my swf is invisible under shadowbox (in IE)
- shodowbox appears under my swf (in FF3)

Any ideas ? Many forumers looking for too.
Or Be resolved an other day !

Ciao

1234