A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: opening a new window?

  1. #1
    suvat cobhc's Avatar
    Join Date
    Jan 2004
    Location
    england
    Posts
    156

    opening a new window?

    can a new window be opened by pressing a button?
    thanks
    cobhc

  2. #2
    Senior Member
    Join Date
    Apr 2001
    Posts
    316
    i do it like this:

    first ad this script into the body of the html page holding your swf is in

    <SCRIPT LANGUAGE=JavaScript>
    function newwindow (){
    window.open('newwindow.html','somename','width=320 ,height=240,toolbar=no');
    }
    </SCRIPT>

    change anything in there you need such as width, names, height etc.

    then add this to a button getURL("javascript:newwindow()")

    it basically tells the javascript function to trigger and oper the new window. if anyone has a simpler way please post it cus i'm curious too

  3. #3
    suvat cobhc's Avatar
    Join Date
    Jan 2004
    Location
    england
    Posts
    156
    hey thanks
    this is just what i need.
    Another question now.lol :s. is ther anyway a new window can be opened within flash itself? I need this for the same project as i needed for that code^^^^^^^^^^^^^
    thanks again
    cobhc

  4. #4
    Senior Member
    Join Date
    Apr 2001
    Posts
    316
    what you mean open a html window into a flash movie? you can't do that

    you can use loadMovie() to load one swf into another though

  5. #5
    suvat cobhc's Avatar
    Join Date
    Jan 2004
    Location
    england
    Posts
    156
    sorry,perhaps i havnt been accurate in my description.
    What i basically want is to open an mc by pressing a button. Ie (this isnt it but its an example) i have a game and in an mc i have sound options but that mc doesnt open until a button is pressed. However im fairly sure it needs an _root.attachMovieClip function am i right?
    cobhc

  6. #6
    Member
    Join Date
    Mar 2004
    Posts
    54
    how do you use the loadmovie function ? i need to do that for my flash website because i have a problem with the javascript popup...
    hey !

  7. #7
    Senior Member
    Join Date
    Apr 2001
    Posts
    316
    that sound example confused me more man... what is it you want to do exactly.
    if you have made a movie using flash and you called it 'one.swf' and then made a second called 'two.swf', and you wanted to load the second into the first or visa versa you would use loadmovie (). If in your existing movie you had created a movie clip (saved it and everything) but have not actually used it on the timeline.. thats when you would use the attachMovie (). if you explain what you want to do it might be easier.

  8. #8
    suvat cobhc's Avatar
    Join Date
    Jan 2004
    Location
    england
    Posts
    156
    lol
    ok ill give you a better example. Im making a game, and on this game a new window is opened with all the game options; Sound levels, quality etc. But the mc that holds all these little sliders etc is in an mc. With me?
    Now the mc only exists in the library until you press the menu button. Do you get me. im farily sure i should be using
    code:
    attachMovie() 


    thanks
    cobhc

  9. #9
    Senior Member
    Join Date
    Apr 2001
    Posts
    316
    yep! attachMovie is the one. all you have to do is give it a name to export with, in the linkage property option. Just in case you don't know were that is right click on the name in the library and choose export using actionscript. if you did know that ignore me

  10. #10
    suvat cobhc's Avatar
    Join Date
    Jan 2004
    Location
    england
    Posts
    156
    Take a look at this.
    What am i doing wrong lol.
    thanks cobhc

  11. #11
    Senior Member
    Join Date
    Apr 2001
    Posts
    316
    on (release){
    _root.attachMovie("menu", "nu_name", 0)
    }

    this is how you use attachMovie. the first parameter is the name from the Library, the one u added using the 'linkage'
    the second parameter is the name of the instance u are attaching to the Movie during runtime. so now if you want to target the attached Movie you would use _root.nu_name (_root.nu_name._x, _root.nu_name._alpha etc.)
    the last parameter is used to tell the movie what level (depth) to place the new clip.

  12. #12
    suvat cobhc's Avatar
    Join Date
    Jan 2004
    Location
    england
    Posts
    156
    thanks again
    ive always struggled with that.
    your a legend!
    thanks
    cobhc

    p.s. if i wanted to change the position of the menu, it would be the 0 i would change right?
    so instead of 0 it would be like 5, 6?

  13. #13
    Senior Member
    Join Date
    Apr 2001
    Posts
    316
    on (release){
    _root.attachMovie("menu", "nu_name", 0)
    _root.nu_name._x = (some number)
    _root.nu_name._y = (some number)
    }
    once you attach the movie you can do
    everything to it you can to a normal movie clip on the stage - the 0 is the 'depth'
    imagine you had a stack of papers. obviouly one is ontop of the other so when you move them the highest overlaps the one underneath it and so on. the depth starts at 0 as the lowest sheet, 1 is lies on top of it 2 on top of that etc. playing with the levels is the equivalent of stacking layers on the timeline.

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