A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 28

Thread: pop up window problem

  1. #1
    Junior Member
    Join Date
    Jun 2004
    Posts
    27

    pop up window problem

    It's me again, struggling away............
    I know this looks long to you and you probably will want to just skip it but.........I have put everything down from A........Z

    So if anyone has some patience for me....please read ahead.
    Thank you in advance.

    I've been working on this all morning and still haven't succeeded.
    Let me start from the beginning:

    1. I have company profile that I did entirely on Flash (called) laceco.swf which contains approx. 75 scenes. Each scene represents a page layout with buttons taking you from one page to the other.

    2. On some pages I am supposed to have another button which should link you to another movie (s) called photogallery.swf

    3. I am not using any html pages just pure Flash so in the end when I publish it, it will be a .swf file and not an .html file. The end result is an autorun file on a cd.

    My Aim

    1. Is to put my photogallery on a separate pop up menu.

    My Problem:

    1. First attempt: I put in the actions menu the name of movie (photogallery.swf) in the Get URL and put _blank in the window. What I got was my movie in a browser window with all the buttons and menus.

    2. Second attempt: I was advised to try this from actionscript.org but obviously I did something wrong first because I only got to the first java script.....the second and third......you can forget it.....got lost along the way.

    Tutorial details:
    Written by: Strok
    Difficulty Level: Beginner
    Requirements: Flash 4 or above

    Download the source for this tutorial.

    The code for this tutorial is divided into 2 parts HTML code and FLASH code

    Part 1 -- FLASH code

    In actions choose the GET URL function and paste in following code:

    javascriptpenNewWindow('somePage.html','thewin',
    'height=100,width=250,toolbar=no,scrollbars=yes');

    Where somePage.html is the filename or URL of the page or site you wish to pop up.
    Note: The above code is spread over two lines for tutorial neatness only. In Flash it need be on only one line.

    Part 2 ---HTML code

    Paste this code exactly as it appears below, between the HEAD tags in the HTML source.

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

    Add the following parameter inside the <EMBED> tag in your HTML page which houses the SWF file:

    swLiveConnect=true NAME=yourmovie.swf

    Replace "yourmovie" with the name of flash movie. You can put it anywhere inside the <EMBED> tag, but perhaps the best place would be after the WIDTH and HEIGHT parameters
    Note: This is important as it allows the Flash movie to communicate with the JavaScript code.

  2. #2
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,490
    So load photogallery.swf to a level of the main movie:

    on(release){
    loadMovieNum("photogallery.swf", 1);
    }

    That loads it to the main movie, on top of it, since all levels are above any layer in the main movie timeline. It'll look like a popup, but without the browser. You can position it or resize it or even make it draggable.

  3. #3
    Junior Member
    Join Date
    Jun 2004
    Posts
    27
    Ok....let me try to understand this in more simpler way.
    I told you I am a real beginner.

    you mean do I assign this action for my button?

  4. #4
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,490
    Yes. Just put that on a button and see what happens. The photogallery.swf should be in the same folder. It will load on top of the content in the main movie, with it's top left corner at the top left corner of the main movie. You can control that with a couple lines in the photogallery.swf.

    But try it first, the affect may not be what your looking for.

  5. #5
    Junior Member
    Join Date
    Jun 2004
    Posts
    27
    Thank You iaskwhy!!!!

    It actually worked!

    Now if I can only get it to"position it or resize it or even make it draggable" like you mentioned. How can I close it and get back to my main page?

  6. #6
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,490
    To position it, inside the photogallery.fla, first frame, actions layer, at the top:

    this._x = 50;
    this._y = 50;

    Positions it's top left corner at 50, 50 on the main stage.

    To close it, add a little close button in one of the movies with this on it:

    on(release){
    _root.unloadMovieNum(1);
    }

    Add this under the position lines above to resize. Not sure about this, since your going to be on a CD, but try it:

    this._xscale = 100;
    this._yscale = 100;

    The 100 is a percent of the original size.

    To drag it, make a little drag movie clip and put it in the photogalery movie on a layer. Just a little box with the word drag, but it has to be a movie clip, then add:

    on(press){
    startDrag("");
    };
    on(release){
    stopDrag();
    };

    That ought to work to drag the whole movie.

  7. #7
    Junior Member
    Join Date
    Jun 2004
    Posts
    27
    Sorry but what do you mean actions layer?

  8. #8
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,490
    Make a new layer for actionscript, and add the code to frame 1.

  9. #9
    Junior Member
    Join Date
    Jun 2004
    Posts
    27
    ok now I understood.
    One more question I am in the process of creating my close button. I was able to put in the action :

    (release){
    unloadMovieNum(1);
    }

    but didn't know how to get the root in there.

  10. #10
    Junior Member
    Join Date
    Jun 2004
    Posts
    27
    Ok .....I managed to make the close button work by just clicking on release and then the unload movie and I put one in the level.
    Is that ok......without the _root?

    Now I will attack the others.

  11. #11
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,490
    Set the actions panel to Expert. You can't do anything in Normal mode, or learn anything.

  12. #12
    Junior Member
    Join Date
    Jun 2004
    Posts
    27
    And where is that located???????Believe I am desperate to learn!!!!!

  13. #13
    Junior Member
    Join Date
    Jun 2004
    Posts
    27
    Preference file........YES!!!!

  14. #14
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,490
    Look at the attached picture.
    Attached Images Attached Images

  15. #15
    Junior Member
    Join Date
    Jun 2004
    Posts
    27
    Thanks iaskwhy for your time.

    I am starting to see a light at the end of the tunnel. I still have some questions though.

    1. I got the action for the "to position it" working

    2. I got the action for the "to close it" working

    3. I am having problems with "to drag it" It is telling me there is error in the script.

    on(press){
    startDrag("");
    };
    on(release){
    stopDrag();
    };

    in the script above where is the name of the movie file. Is it supposed to Drag or in between the("")?

    4.I also didn't understand where I am supposed to put

    this._xscale = 100;
    this._yscale = 100;

    The 100 is a percent of the original size.

    Here is your note:
    Add this under the position lines above to resize.

  16. #16
    Senior Member green_eye's Avatar
    Join Date
    Apr 2004
    Location
    Sarasota, Florida
    Posts
    1,496
    #3
    on (press) {
    startDrag(this);
    }
    on (release) {
    stopDrag();
    }

    #4
    you put that on the first frame in the scripts layer of the external .fla
    Last edited by green_eye; 06-09-2004 at 03:44 PM.

  17. #17
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,490
    I add this to the drag movie clip, just like it was a button. On the clip, not in a frame.

    on(press){
    startDrag("");
    };
    on(release){
    stopDrag();
    };

    The double quotes infers that it's the whole movie timeline, not just that clip.

    Frame 1 would look like this:

    this._x = 50;
    this._y = 50;
    this._xscale = 100;
    this._yscale = 100;

  18. #18
    Junior Member
    Join Date
    Jun 2004
    Posts
    27
    ok......let's say my movie is called "drag" which it is......where is the title of the movie......this??? and what about on release.

    on (press) {
    startDrag(this);
    }
    on (release) {
    stopDrag();
    }

  19. #19
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,490
    OK, I was wrong. That doesn't work. Instead, use frame code in frame one of the movie that has the drag clip in it:

    _root.drag.onPress = function() {
    startDrag("");
    };
    _root.drag.onRelease = function() {
    stopDrag();
    };
    Attached Files Attached Files

  20. #20
    Senior Member green_eye's Avatar
    Join Date
    Apr 2004
    Location
    Sarasota, Florida
    Posts
    1,496
    this-- reference the timeline it is being called from
    use this code inside external fla
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center