Groups

    Calling all people who use Adobe flash!

    What am i doing wrong?

    Im creating a Host movie, where 5-6 buttons will be loaded from.


    However, im having difficulties coding each button to open an swf file.


    Here is the code i have to try and load my ipod button.


    stop();
    ipod_btn.addEventListener(MouseEvent.CLICK,ipod_btn);
    function ipod_btn(event:MouseEvent) {
    var request:URLRequest = new URLRequest("ipod.swf");
    var loader:Loader = new Loader()
    loader.load(request);
    addChild(loader);
    }


    However, it doesnt do anything and i get these complier errors


    1023: Incompatible override.

    1021: Duplicate function definition.


    i will be grateful for any help

    5 Comments

    You can't call a function the same name as an object..

    Edit: I'm also thinking addChild() won't work until you attach it to the parent - not sure what the parent is called though (It was _root in AS1/2 i think)- i'm not great with Actionscript 3.

    Don't use adobe.

    Steve
    Sent from my iPad

    Original Poster

    razord;8590912

    You can't call a function the same name as an object..Edit: I'm also … You can't call a function the same name as an object..Edit: I'm also thinking addChild() won't work until you attach it to the parent - not sure what the parent is called though (It was _root in AS1/2 i think)- i'm not great with Actionscript 3.



    Managed to get it working...however opens a new web page rather than in swf...

    Here is completed working code so far

    "
    stop();

    ipod_btn.addEventListener(MouseEvent.CLICK,openSwf );

    function openSwf(event:MouseEvent):void
    {
    var request:URLRequest=new URLRequest("ipod.swf");
    navigateToURL(request);
    }
    "

    vengod;8591124

    Managed to get it working...however opens a new web page rather than in … Managed to get it working...however opens a new web page rather than in swf...Here is completed working code so far"stop();ipod_btn.addEventListener(MouseEvent.CLICK,openSwf );function openSwf(event:MouseEvent):void{var request:URLRequest=new URLRequest("ipod.swf");navigateToURL(request);} "



    That doesn't surprise me - i didn't even realise you could include an external SWF in another one. I'm pretty sure you'll have to load each movie as a scene in the same file, and jump to that scene on button click instead.

    That how i'd do it, but i'm probably wrong!

    Edit: Okay fine, i got way too interested and looked it up.

    You need a movieClip on stage and named:
    myMovieClip.loadMovie("myExternalMovie.swf");

    Original Poster

    razord;8591136

    That doesn't surprise me - i didn't even realise you could include an … That doesn't surprise me - i didn't even realise you could include an external SWF in another one. I'm pretty sure you'll have to load each movie as a scene in the same file, and jump to that scene on button click instead.That how i'd do it, but i'm probably wrong!



    Nah, scences have been mentioned before. But ive never used multiple scences. to be honest, i hate flash. But its part of my course so gotta do it
    Post a comment
    Avatar
    @
      Text
      Top Discussions
      1. Best Custom ROM for XIaomi Redmi Note 233
      2. Virgin Media TV67
      3. Samsung 4k TVs which one 49/55inch curved? £1.50023
      4. Does the app aznog still work?11

      See more discussions