Skip navigation
Currently Being Moderated

Creating Pop up Window from Flash with Actionscript 3

May 5, 2011 12:50 AM

Hello!

 

Im still new at this but would appreciate some help with this.

 

I have created a Flash banner with Actionscript 3.

 

Within the banner I would like to make an animated button that when clicked will open

another swf file within a pop up window with specified dimensions.

 

I have found java codes that work with Actionscript 2,

and also with Flash player 5 and lower.

 

But my banner uses effects that require me to export the clip no lower than Flash player 10.

 

Can I still create a pop up window with specific dimensions?

 

Thank you very much in advance for your help!!!

 

Kindest regards,

 

Coz

 
Replies
  • Currently Being Moderated
    May 5, 2011 2:02 AM   in reply to bkrascal

    If you'r going to show another swf within your swf, then just create a new movieclip and load the swf inside that and keep the depth to the highest level to show the popup.

     
    |
    Mark as:
  • Currently Being Moderated
    May 5, 2011 2:31 AM   in reply to bkrascal

    In as2 or as3 you can use ExternalInterface.call() function to call javascript function of your html wrapper  and in that javascript function you can write code for opening your externl html popup window using window.open

     
    |
    Mark as:
  • Currently Being Moderated
    May 5, 2011 2:42 AM   in reply to bkrascal

    <a href="javascript:NewWindow('index_scorm.html?yup=1','asdasd','900','8 00','no','center');">

     

    The above is the html code, Just implement with the button click using the external interface.

     
    |
    Mark as:
  • Currently Being Moderated
    May 5, 2011 3:44 AM   in reply to bkrascal

    This should open a 900 x 800 window with the URL:

            function click(e:MouseEvent):void {
                ExternalInterface.call("window.open", "http://www.adobe.com/", "win", "width=900,height=800");
            }
    

    (You don't need Javascript in the HTML with this )

     
    |
    Mark as:
  • Currently Being Moderated
    May 5, 2011 3:29 AM   in reply to bkrascal

    Open your html version that you used to embed your flash:

     

    Add this script within the head tag:

     

    <SCRIPT LANGUAGE=JavaScript>
            function openNewWindow(URLtoOpen, windowName, windowFeatures) {
              newWindow=window.open(URLtoOpen, windowName, windowFeatures);
            }
    </SCRIPT>

     

    Open flash and write the below code for the button:

     

    test.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);

     

    function fl_MouseClickHandler(event:MouseEvent):void
    {
        var url:URLRequest = new  URLRequest("javascript:openNewWindow('http://www.macromedia.com','thewin','height=400,width=400,toolbar=no,s crollbars=yes')");
        navigateToURL(url,"_self");
    }

     

    Tested it! works!

     
    |
    Mark as:
  • Currently Being Moderated
    May 5, 2011 3:34 AM   in reply to bkrascal

    Flash code

     

    m1.addEventListener("click", openNew);
    function openNew(e:Event) {
        ExternalInterface.call("openWin");
    }

     

    Javascript code

     

    <script language="javascript">

    function openWin(){
         window.open('popup.htm','Popup','width=1004,height=657,scrollbars=no, resizable=no,status=no');
    }

    </script>

     

    Just copy and paste this

     
    |
    Mark as:
  • Currently Being Moderated
    May 5, 2011 4:03 AM   in reply to bkrascal

    Test is the name of my sample movieclip, give your movieclip instance name

     
    |
    Mark as:
  • Currently Being Moderated
    May 5, 2011 11:14 PM   in reply to bkrascal

    OK brother.

     

    Because may b you are using tween to animate the button.

     

    And I think you have given the instance name to manual_btn on the end keyframe of tween on timline

     

    you should give same instance name to  the start keyframe of tween also.

     
    |
    Mark as:
  • Currently Being Moderated
    May 6, 2011 12:20 AM   in reply to bkrascal

    Dear

     

    This code needs to be in your fla

     

    m1.addEventListener("click", openNew);

    function openNew(e:Event) {

        ExternalInterface.call("openWin");

    }

     

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

    And this is not the part of fla below code needs to be in which you swf is embeded

     

    <script language="javascript">

    function openWin(){

         window.open('popup.htm','Popup','width=1004,height=657,scrollbars=no, resizable=no,status=no');

    }

    </script>

     

    popup.htm is the html page you want to open on click

     

     

    And I think relaxatraja example code should also work (i didnt test that) just give the instance name to the button on start and end frame of tween

     
    |
    Mark as:
  • Currently Being Moderated
    May 6, 2011 12:38 AM   in reply to bkrascal

    first one is right

     

    but second one is not

     

    this code

     

    <script language="javascript">

    function openWin(){

         window.open('popup.htm','Popup','width=1004,height=657,scrollbars=no, resizable=no,status=no');

    }

    </script>

     

    needs to in your html page head tag . HTML Page which holds the swf file having button to click to open popup.

     

    U can giv me your mail id so that i can send u running sample. if its still not working.

     

     

    popup.html and the embeded swf in popup html does not contain any of my code.

     
    |
    Mark as:
  • Currently Being Moderated
    May 6, 2011 1:34 AM   in reply to bkrascal

    I send u the packet. Its a sample to get u the idea. swf are not the size u want but from this sample u can get the idea of code and the flow. Pls let me know your response

     
    |
    Mark as:
  • Currently Being Moderated
    May 6, 2011 1:51 AM   in reply to bkrascal

    If it possible send your files to the following id:relaxatraja@aol.com

     
    |
    Mark as:
  • Currently Being Moderated
    May 6, 2011 1:54 AM   in reply to relaxatraja

    done. is your job done!

     
    |
    Mark as:
  • Currently Being Moderated
    May 6, 2011 3:14 AM   in reply to bkrascal

    Surprised!,

     

    Please check

     

              1. popup blocker in your browswers

              2. flash player version in your browsers

     

    ok send me your files. but make sure they are not in cs5. coz I have cs4

     
    |
    Mark as:
  • Currently Being Moderated
    May 6, 2011 3:24 AM   in reply to Anil Bakshi

    Hi bkrascal,

     

    Please send your files to the id even with flash cs5 format, so that we can sort it out easily : relaxatraja@aol.com

     
    |
    Mark as:
  • Currently Being Moderated
    May 6, 2011 3:59 AM   in reply to bkrascal

    working.JPG

     

    Header_actionscript3_extrabtn4.html click on this page see the ettect

     

    File send back check

     
    |
    Mark as:
  • Currently Being Moderated
    May 6, 2011 7:19 AM   in reply to bkrascal

    I sent you the mail, hope this is your id coz@familycards.nl

     
    |
    Mark as:
  • Currently Being Moderated
    May 7, 2011 5:06 AM   in reply to bkrascal

    File has been sent already.


     
    |
    Mark as:
  • Currently Being Moderated
    May 11, 2011 2:42 AM   in reply to relaxatraja

    Is your problem solved. If not please check the

    global secrity settings

    panal

     
    |
    Mark as:
  • Currently Being Moderated
    May 11, 2011 4:39 AM   in reply to bkrascal

    Great! Finally u got it. Thats very  pleasuring. Sorry dear dont have any idea about that component but I will try to search if I found let u know.

     

    No I dint lost on you I was not in ofc coz of health reason. I came in today and just check your post and asked you about the situation.

     

    COZ Programming is about keep digging. Deep you can dig far u can go.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points