A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: load swf

  1. #1
    Junior Member
    Join Date
    Apr 2005
    Posts
    5

    load swf

    I hope someone can help me with this...

    I have my main movie (Residential) and load an external swf (libero), but this swf, don't play the action on the button
    how can i fixed???

    thanks

    n4v4

  2. #2
    Goodbye...
    Join Date
    Aug 2003
    Posts
    661
    If you're trying link that button to the "Residential" movie (or somewhere in it), your AS would be something like this:
    code:
    on (release) {
    _root.gotoAndPlay("frameLabel");
    }

    Just change the frameLabel or frame number.

  3. #3
    Sockpuppet
    Join Date
    Mar 2005
    Location
    Who cares?
    Posts
    177
    Think he means, that when loaded in his other main movie, the button(s) in the loaded movie no longer work(s).

  4. #4
    Goodbye...
    Join Date
    Aug 2003
    Posts
    661
    Originally posted by Dedic
    Think he means, that when loaded in his other main movie, the button(s) in the loaded movie no longer work(s).
    Yeah, I guess if he/she means the rollOvers then, yeah, my post is wrong.

  5. #5
    Junior Member
    Join Date
    Apr 2005
    Posts
    5

    load swf

    yeah!!! the problem is that, in the main movie Itry to load an external sfw, this external swf load but the button doesn't work, the action for that button is drag a movie clip in the movie, but how i say doesn't work
    what can i do???

  6. #6
    Junior Member
    Join Date
    Apr 2005
    Posts
    5

    any help with load swf

    the problem is that, in the main movie I try to load an external sfw, this external swf load but the button doesn't work, the action for that button is drag a movie clip in the movie, but how i say doesn't work
    what can i do???

  7. #7
    Junior Member
    Join Date
    Apr 2005
    Posts
    8
    can you make another instance of the button for the movie? does it work after the swf?

    what kind of action do you want to perform with the "play" button is it? after the movie has started?

  8. #8
    Junior Member
    Join Date
    Apr 2005
    Posts
    5

    load swf

    ok here we go...
    in the external swf (named libero), i have 1 pic in small size and the same in a big size, and when you moved the over the little pic area shows that move in the big one, both pics are a movie clips the code for that move is...
    // set up bkg_mc info
    contentRight = _root.bkg_mc._x;
    contentLeft = 458.1 - _root.bkg_mc._width;
    contentBottom = _root.bkg_mc._y;
    contentTop = 384.4 - _root.bkg_mc._height;

    // set up gutter info
    gutterLeft = _root.scrollGutter_mc._x;
    gutterRight = ((_root.scrollGutter_mc._x + _root.scrollGutter_mc._width) - this._width);
    gutterTop = _root.scrollGutter_mc._y + 0;
    gutterBottom = ((_root.scrollGutter_mc._y + _root.scrollGutter_mc._height) - this._height);


    // use the hand icon
    this.useHandCursor = true;


    // handle press event
    this.onPress = function() {
    this.startDrag(false, gutterLeft, gutterTop, gutterRight, gutterBottom);
    dragging = true;
    this.onMouseMove = function() {
    updateAfterEvent();
    };
    };

    // handle release event
    this.onRelease = this.onReleaseOutside = function() {
    this.onMouseMove = undefined;
    this.stopDrag();
    dragging = false;
    xSpeed = (newxpos-oldxpos)*RATIO;
    ySpeed = (newypos-oldypos)*RATIO;
    };


    // set initial variables
    FRICTION = .9;
    RATIO = .5;
    dragging = false;

    // handle onEnterFrame event
    this.onEnterFrame = function() {
    if (!dragging) {
    oldxpos = this._x;
    newxpos = oldxpos+xSpeed;
    xSpeed *= FRICTION;
    oldypos = this._y;
    newypos = oldypos+ySpeed;
    ySpeed *= FRICTION;
    if (newxpos>gutterRight || newxpos<gutterLeft ) {
    trace('_x and _y');
    xSpeed *= -FRICTION;
    newxpos = oldxpos;
    }
    if (newypos>gutterBottom || newypos<gutterTop){
    trace('top and bottom');
    ySpeed *= -FRICTION;
    newypos = oldypos;
    }
    this._x = newxpos;
    this._y = newypos;
    // always move bkg_mc whether dragging or not
    var xpercent = (this._x-gutterLeft)/(gutterRight-gutterLeft);
    var ypercent = (this._y-gutterTop)/(gutterBottom-gutterTop);
    this._parent.bkg_mc._x = xpercent*(contentLeft-contentRight)+contentRight;
    this._parent.bkg_mc._y = ypercent*(contentTop-contentBottom)+contentBottom;
    } else {
    oldxpos = newxpos;
    newxpos = this._x;
    oldypos = newypos;
    newypos = this._y;
    // always move bkg_mc whether dragging or not
    var xpercent = (this._x-gutterLeft)/(gutterRight-gutterLeft);
    this._parent.bkg_mc._x = xpercent*(contentLeft-contentRight)+contentRight;
    var ypercent = (this._y-gutterTop)/(gutterBottom-gutterTop);
    this._parent.bkg_mc._y = ypercent*(contentTop-contentBottom)+contentBottom;
    }
    };

    this works fine in the swf, but when i load this swf in another movie, doesn't work

  9. #9
    Sockpuppet
    Join Date
    Mar 2005
    Location
    Who cares?
    Posts
    177
    If it works fine on it's own, then it's your references to _root in your loaded movie that now wrongly point to the root level of the main movie, once it's loaded in that main movie, rather than the root level of the loaded movie itself...

    You have to change those references to _root, with the appropriate this and/or 1 or more _parent's...

    Or if you happen to be on MX2004, you can look into _lockroot, which should solve your problem...

    http://livedocs.macromedia.com/flash...=00001522.html

  10. #10
    Junior Member
    Join Date
    Apr 2005
    Posts
    5

    load. swf solved

    Thanks a lot for your help

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