A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: asFiles problem... help!

  1. #1
    Junior Member
    Join Date
    Sep 2008
    Posts
    5

    asFiles problem... help!

    Hello

    I have an asFile located in a folder which controls a menu in my flash animation. It was set so the swf file loads inside a main animation. BUT. I would like my menu to "gotoAndPlay" a specific scene in the actual animation. Can someone help me? (I am not very advanced in Flash knowledge).

    Here ia a part of the script that I "think" controls what happens when we click on a menu item :


    function ctrMenu(menuID:MovieClip):Void {
    if(!menuID.isOpen) { openMenu(menuID); }
    else { closeMenu(menuID); }

    loadContent(menuID);
    }


    function loadContent(menuID:MovieClip):Void {
    _root.callSlide(menuID.swfPath, menuID.sceneName);
    }



    thanks

  2. #2
    Developing For Dunkets mneil's Avatar
    Join Date
    Mar 2007
    Location
    Lincoln City
    Posts
    2,156
    what you wrote, and the code you gave do not go together. None of the functionallity you describe wanting is in that code. All you've shown are a couple of functions that call a couple of other functions. So, try explaining it again and giving some more detail as to what is going on and I'll try to help more.

    Also, you import as files, you load swf files. Is you're file a .as, or a .swf? I'm thinking a swf since you cant load the as file nor put a menu inside of one. Please try to be more specific.
    http://code.mneilsworld.com/
    Text Effects | Bubbles | Dynamic Resize
    4 weeks , 20 papers ... thats 2 dollars .....Caassshhh!

  3. #3
    Junior Member
    Join Date
    Sep 2008
    Posts
    5
    My presentation is a .exe file that loads .swf files in level 1.
    I have a .as file that contains script and xml file that contains the menu items and swf file to point at.

    All I want is my menu items to load swf files and my menu to unload when a swf file is loaded. Its hard for me to explain but here is one of the scripts that was created for the menu.

    /*===========================================
    * Variables Declaration
    ===========================================*/
    var loadInterval:Number;



    /*===========================================
    * Variables Declaration
    ===========================================*/

    // Call the initial APP content
    //===========================================
    function initLoadContent():Void {
    mc_loadedSection.createEmptyMovieClip("mc_tempFile ",1);
    mc_loadedSection.mc_tempFile.loadMovie("satellite. swf", 2);
    }


    // Load the new content (swf document)
    // Parameters :
    // swfPath - document to load
    // sceneName - lablel name of the scene
    // with the content
    //===========================================
    function callSlide(swfPath:String, sceneName:String):Void {
    clearInterval(loadInterval);

    mc_loadedSection.mc_tempFile.unloadMovie();
    mc_loadedSection.mc_tempFile._visible = true;
    mc_loadedSection.mc_tempFile.loadMovie(swfPath);

    if(arguments.length > 1 && sceneName != null && sceneName != "null")
    loadInterval = setInterval(gotoSelectedSlide, 50, sceneName);
    else
    mc_loadedSection._visible = true;
    }


    // Function called if there is a specific
    // scene to go when the swf is loaded
    // Parameter :
    // sceneName - lablel name of the scene
    // with the content
    //===========================================
    function gotoSelectedSlide(sceneName):Void {

    if(mc_loadedSection.mc_tempFile._totalframes >= 1 && mc_loadedSection.mc_tempFile._framesloaded >= mc_loadedSection.mc_tempFile._totalframes) {
    mc_loadedSection.mc_tempFile.gotoAndPlay(sceneName );
    mc_loadedSection._visible = true;

    clearInterval(loadInterval);
    }
    }


    // Used to close the main menu
    //===========================================
    function closeMenu():Void {
    mc_menu._visible = false;
    //*** mc_menu.resetBtn();
    }


    // Used to open the main menu
    //===========================================
    function openMenu():Void {
    mc_menu._visible = true;
    }



    /*===========================================
    * Init Functions Call
    ===========================================*/
    openMenu();
    initLoadContent()

  4. #4
    Developing For Dunkets mneil's Avatar
    Join Date
    Mar 2007
    Location
    Lincoln City
    Posts
    2,156
    again, this is only part of it. There is nothing wrong with anything you have here. I'm really unsure as to what your question is. You've told me what you want to do, you've shown me code, but you haven't given me a problem. Is something not working? What XML? You're importing the as file and what is calling the functions? What menu?
    http://code.mneilsworld.com/
    Text Effects | Bubbles | Dynamic Resize
    4 weeks , 20 papers ... thats 2 dollars .....Caassshhh!

  5. #5
    Junior Member
    Join Date
    Sep 2008
    Posts
    5
    the last script is located in the .as file.
    The xml file contains the menu items and where they are linked.

    what happens is when I click on a menu item, the code load a movie (.swf) under my menu. What I want the code to do is
    - load a movie(.swf) over the menu.
    Or
    unload the menu and load the movie at its place (preferrable)

    There is also another script located in the menu :

    /*===========================================
    * System preference Setup
    ===========================================*/
    System.useCodepage = true;



    /*===========================================
    * fscommand init call
    ===========================================*/
    fscommand("fullscreen", true);
    fscommand("alloscale", false);
    fscommand("showmenu", false);



    /*===========================================
    * Variables Declaration
    ===========================================*/
    var loadInterval:Number;



    /*===========================================
    * Variables Declaration
    ===========================================*/

    // Call the initial APP content
    //===========================================
    function initLoadContent():Void {
    mc_loadedSection.createEmptyMovieClip("mc_tempFile ",1);
    mc_loadedSection.mc_tempFile.loadMovie();
    }


    // Load the new content (swf document)
    // Parameters :
    // swfPath - document to load
    // sceneName - lablel name of the scene
    // with the content
    //===========================================
    function callSlide(swfPath:String, sceneName:String):Void {
    clearInterval(loadInterval);

    mc_loadedSection.mc_tempFile.removeMovieClip();
    mc_loadedSection.createEmptyMovieClip("mc_tempFile ", 1);
    mc_loadedSection._visible = false;
    mc_loadedSection.mc_tempFile.loadMovie(swfPath);

    if(arguments.length > 1 && sceneName != null && sceneName != "null")
    loadInterval = setInterval(gotoSelectedSlide, 50, sceneName);
    else
    mc_loadedSection._visible = true;
    }


    // Function called if there is a specific
    // scene to go when the swf is loaded
    // Parameter :
    // sceneName - lablel name of the scene
    // with the content
    //===========================================
    function gotoSelectedSlide(sceneName):Void {

    if(mc_loadedSection.mc_tempFile._totalframes >= 1 && mc_loadedSection.mc_tempFile._framesloaded >= mc_loadedSection.mc_tempFile._totalframes) {
    mc_loadedSection.mc_tempFile.gotoAndStop(sceneName );
    mc_loadedSection._visible = true;

    clearInterval(loadInterval);
    }
    }


    // Used to close the main menu
    //===========================================
    function closeMenu():Void {
    mc_menu._visible = false;
    //*** mc_menu.resetBtn();
    }


    // Used to open the main menu
    //===========================================
    function openMenu():Void {
    mc_menu._visible = true;
    }



    /*===========================================
    * Init Functions Call
    ===========================================*/
    openMenu();
    initLoadContent()

  6. #6
    Developing For Dunkets mneil's Avatar
    Join Date
    Mar 2007
    Location
    Lincoln City
    Posts
    2,156
    I don't know where your menu is located but from what I can tell I'd guess it is on the _root timeline, and so is the content area. Try two things, first replace this:

    PHP Code:
    function initLoadContent():Void {
    mc_loadedSection.createEmptyMovieClip("mc_tempFile ",1);
    mc_loadedSection.mc_tempFile.loadMovie("satellite. swf"2);

    with:

    PHP Code:
    function initLoadContent():Void {
    mc_loadedSection.createEmptyMovieClip("mc_tempFile ",getNextHighestDepth());
    mc_loadedSection.mc_tempFile.loadMovie("satellite. swf"2);

    If that doesn't work, try this:

    PHP Code:
    function initLoadContent():Void {
    mc_loadedSection.createEmptyMovieClip("mc_tempFile ",1);
    mc_loadedSection.mc_tempFile.loadMovie("satellite. swf"2);
    mc_loadedSection.swapDepths(mc_menu);

    If neither of thos works then your menu is located on some other level beside this mc_loadedSection. If that is the case then let me know the structure of the fla and how everything is setup and we can figure it out that way.
    http://code.mneilsworld.com/
    Text Effects | Bubbles | Dynamic Resize
    4 weeks , 20 papers ... thats 2 dollars .....Caassshhh!

  7. #7
    Junior Member
    Join Date
    Sep 2008
    Posts
    5
    thanks, let me try it and i'll get back to you!

  8. #8
    Junior Member
    Join Date
    Sep 2008
    Posts
    5
    doesn't work. I probably have 2 scripts conflicting or something like that somewhere else.

    The way everything is setup, is that I have a main file that has a background image and over that I load animations.

    In one of the animations, there is this "menu" that its content is in the xml file, and the as file orders what to do. The last script I sent you is located in the first frame of the animation that contains the menu.

    Unless there is another way I can arrange the architecture of this animation, I really dont know what to change in the scripts (because I havent created it and the person who did is no longer reachable).

    Maybe i can post picture clippings of it?!

  9. #9
    Developing For Dunkets mneil's Avatar
    Join Date
    Mar 2007
    Location
    Lincoln City
    Posts
    2,156
    give me instance names and examples. Maybe give me a tree, Youve go

    _root- loadedAnimations-menu
    -asFile-mc_loadedSection-mc_tempFile

    You need to get mc_loadedSection to be above the menu. So, basically what you need to do is get a common area where both of the clips reside and swap them, so if menu is located inside of loadedAnimations, and also inside of loadedAnimation is a clip named loadedSwfs, which has loadedMC, which has tempMC, then you need put loadedSwfs above menuMC.
    http://code.mneilsworld.com/
    Text Effects | Bubbles | Dynamic Resize
    4 weeks , 20 papers ... thats 2 dollars .....Caassshhh!

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