A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: I think it's a path problem!?

  1. #1
    Junior Member
    Join Date
    Apr 2007
    Posts
    12

    I think it's a path problem!?

    Ok so here is the deal.

    First level of site:
    button rigged to load external swf file, (its called portfolio), into a movie clip instance called "maincontainer"

    Portfolio (swf):
    its a gallery containing thumbnails that load external swf files ( images), into a movieclip instance called "container". The images have load and unload animations.
    the code on the buttons is:

    on (release) {
    if (_root.currMovie == undefined) {
    _root.currMovie = "imgeoneblack";
    _root.container.loadMovie("imgeoneblack.swf");
    } else if (_root.currMovie != "imgeoneblack") {
    if (_root.container._currentframe >= _root.container.midframe) {
    _root.currMovie = "imgeoneblack";
    _root.container.play();
    }
    }
    }

    Problem:
    swf file Portfolio(works like magic on its own) loads but the buttons no longer respond.

    i should mention that there is an auto load command that does do its job and loads the first image when i begin from the main stage.
    that code is:

    _root.currMovie = "imgeoneBlack";
    container.loadMovie(_root.currMovie+".swf");


    ive tried altering path controls a million different ways so im either missing something or wayyyy out of my league... in either case id love some help.


    thanks


    ps.first posts are fun!

  2. #2
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    Hi just_mitch, welcome to flashkit.
    It looks like the first part of your outer if statement is never coming true when it's loaded into the parent movie. When it runs on its own, it looks in _root (which is itself) for a variable called currMovie to see if it's undefined. Since a variable by that name hasn't been set, that's the same as one being undefined. So it gets true and runs your loadMovie line.

    Your auto load command in the parent movie sets a variable called "imgeoneBlack" (which is not equal to "imgeoneblack" by the way, actioscript is very case sensitive) which means it is indeed defined.

    Just take off the assignment at the beginning so that the variable container still exists for use later on, just holds no value.

    Change:
    _root.currMovie = "imgeoneBlack";
    container.loadMovie(_root.currMovie+".swf");

    To:
    _root.currMovie;
    container.loadMovie(_root.currMovie+".swf");

  3. #3
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    Damn this edit timer!
    Sorry man I forgot to change the second line,
    It shoulda said,

    Change:
    _root.currMovie = "imgeoneBlack";
    container.loadMovie(_root.currMovie+".swf");

    To:
    _root.currMovie;
    container.loadMovie("default.swf"); //default.swf is the default movie to load

  4. #4
    Junior Member
    Join Date
    Apr 2007
    Posts
    12
    hey thanks for the reply ill try that out.

  5. #5
    Junior Member
    Join Date
    Apr 2007
    Posts
    12
    So the last plan didn't work!

    i revamped the project just to organize so that i could see what's causing the problem. i also created seperate variable/instance names for the main file and the portfolio file.

    THE MAIN FILE BUTTON ACTIONSCRIPT:
    on (release) {
    if (_root.currMovie == undefined) {
    _root.currMovie = "annekePORTFOLIO";
    _root.container.loadMovie("annekePORTFOLIO.swf");
    } else if (_root.currMovie != "annekePORTFOLIO") {
    if (_root.container._currentframe >=_root.container.midframe) {
    _root.currMovie = "annekePORTFOLIO";
    _root.container.play();
    }
    }
    }

    UNLOAD ACTIONSCRIPT ON MAIN SWF FILES:
    _root.container.loadMovie(_root.currMovie+".swf")

    * works slick!




    THE PORTFOLIO FILE BUTTON ACTIONSCRIPT:
    on (release) {
    if (_root.currPicture == undefined) {
    _root.currPicture = "image_Black";
    _root.containerPORTFOLIO.loadMovie("image_Black.sw f");
    } else if (_root.currPicture != "image_Black") {
    if (_root.containerPORTFOLIO._currentframe >=_root.containerPORTFOLIO.midframe) {
    _root.currPicture = "image_Black";
    _root.containerPORTFOLIO.play();
    }
    }
    }

    * works slick on its own but wont load new images when viewed through the main file.
    * auto load function still loads the default image (this makes me think there is something a miss with my buttons!)

    THE PORTFOLIO FILE AUTO-LOAD ACTIONSCRIPT:
    _root.currPicture;
    containerPORTFOLIO.loadMovie("image_Black.swf");

    UNLOAD ACTIONSCRIPT ON PORTFOLIO SWF FILES:
    _root.containerPORTFOLIO.loadMovie(_root.currPictu re+".swf");


    MY THOUGHTS:
    ok so everything works on its own so the problem must be a confusion/error between the main swf and the portfolio swf.

    the auto load feature works, therefore there is a problem with the the buttons? or maybe the unload code?

    perhaps _root directs to the root of the main swf and not the portfolio swf and since there isn't the correct variable and instance nothing works.


    regardless, im really a rookie and am adapting all this code from a kirupa external swf tutorial, my brain hurts and could use a little help,
    this is a link to the files im using.
    http://www.imagearts.ryerson.ca/mheyens/anneke.zip


    PEACE!

  6. #6
    Member
    Join Date
    May 2007
    Location
    Philippines, Cebu City
    Posts
    31
    hi , so heres the deal,

    your main file, must have this code into it.. _root -- this is ok

    your second file which your main file connects to must not contain : _root

    instead use :

    this or parent....

    anyway here is it..
    http://www.binaryideas.net/clients/...INAL/index.html

    and heres the zip
    http://www.binaryideas.net/clients/...folio_FINAL.zip

    long live flash kit and binaryideas

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