A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: MC troubleshooting - why unable to click on loaded MC????

  1. #1
    Member
    Join Date
    Aug 2002
    Posts
    54

    MC troubleshooting - why unable to click on loaded MC????

    Hey,

    I have 2 small prob's:

    I have my index file which loads an intro.swf on a blank MC on the main timeframe, and the actionscript for the MC is like

    onMovieClip(enterframe)
    {
    loadmovienum("intro.swf",1);
    }
    //i don't have in front of me so "onmovieclip" might be wrong but it's the right one.

    the frame itself has stop(); on it. The prob is that nothing loads on the blank MC and i have no idea why?? it's in the same directory, and such.

    Prob #2:

    That within the intro.swf they play a tile moving game called tile.swf and that is loaded right over the timeline in level0, and when tested, the tile.swf loads fine, BUT I can't click on the tiles to play the game, or the cheat button, I see when i can click (like when cursor over button) but when i click, nothing happens..

    I've tried every variance of the script and am truly STUCK!!!

    PLEASE I need this up and running really really soon!!

    thanks in advance
    Greg Overholt

  2. #2
    Senior Member Pporksoda's Avatar
    Join Date
    Jul 2000
    Location
    baltimore
    Posts
    174
    change onClipEvent(enterFrame) to onClipEvent(Load). Your current script is loading that external SWF over and over again. That's why you're not seeing it. onClipEvent(load) will perform that action only once.

    The most likely reason your buttons aren't working is that your clip hierarchy changes when you load things externally. ie - when you load that game into another movie, its timeline is no longer on the _root. So any actions that are _root relative are screwed.

    Good luck.

  3. #3
    Member
    Join Date
    Aug 2002
    Posts
    54
    Hey man!!

    Thanks a millions, those both were bang on.. but once hitch, in the index loading the intro.swf, it now doesn't load at the tip (top left corner) of the movieclip that the actions are assigned to, it's loading it using the maintimeline top left corner as the loading place, and can't get it to load into the movie that the actions are assigned in..

    onClipEvent (load)
    {
    loadMovieNum("intro.swf",1);
    }

    thanks in advance again man!
    Greg Overholt

  4. #4
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    You can't position a movie loaded on another level until you're sure it's fully loaded. Contrary to loading a movie in a container clip that you can position since it already exists, you simply can't position something that doesn't exists yet, when loading the same movie on a level!
    That said, you can pre-position it, by changing it's position relative to the top_left corner of your main movie, within the "to be loaded movie" itself, by adding the following on it's first frame...

    this._x = 150; // Example... Offset from top-left corner (0,0)
    this._y = 222; // Example... Offset from top-left corner (0,0)

    Play with those numbers till you get it just right for you.

    Also, what Pporksoda was saying about references to _root, is only mainly valid for external movies loaded in container clips, and not for ones loaded on other levels. When loading an external movie on another level (as you're doing!), using _root refers to the main timeline of the loaded movie itself, and not the main timeline of the main movie in which this movie is loaded, which in this case is referred to with _level0.

    So you shouldn't need to make changes in your references to _root.
    Last edited by oldnewbie; 08-04-2004 at 11:41 PM.

  5. #5
    Senior Member Pporksoda's Avatar
    Join Date
    Jul 2000
    Location
    baltimore
    Posts
    174
    You can also position the contents of a level alone.
    Code:
    _level1._x = 200;
    _level1._y = 150;
    But it only works AFTER content exists in that level. So executing level transformations in the same frame that content is loaded may not register.

  6. #6
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    That's why loaded movies should allways be of the same dimensions as the main movie in which they'll be loaded, and created with the main movie's layout in mind and/or even with specific references to main elements' positions.
    Then the default top-left corner loading, as such, would allways work.
    Positioning it differently (or altering any other property) from the main movie can't only be done when it's fully loaded, and in the end is much more complicated, then pre-altering position (or any other property) within the loaded movie itself, if need be.

  7. #7
    Member
    Join Date
    Aug 2002
    Posts
    54
    thx guys, ya that's work..

    But I was originally wanting to load this in a container clip, is the actionscript used not used to load it into a movie container clip?? i'm assuming not, how do i go about doing that, cause isn't that more proper and efficient?

    Greg

  8. #8
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Both have their "pros" & "cons"!

    Loading movies in container clips, mostly requires that you use relative pathing in the loaded movies themselves, which if you're not familiar with, could become another nightmare... But that's another story...

    Some here are definately against using loaded movies on other levels (Hi Gaius! - How slow is it this week in Ireland?), but IMHO and in most relatively simple movies, this would work as well!

    Your choice!

  9. #9
    Senior Member Pporksoda's Avatar
    Join Date
    Jul 2000
    Location
    baltimore
    Posts
    174
    If you're placing the code on the container clip, it would look something like this:
    Code:
    onClipEvent (load) {
    	this.loadMovie("intro.swf", 1);
    }
    It's better to avoid placing actions directly on movieclip instances. An alternative would be to define the container clip using actionscript and load the external flash into it all from a frame action:
    Code:
    this.createEmptyMovieClip("holder", 1);
    this.holder.loadMovie("intro.swf", 0);

  10. #10
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Ummmmmmmmmmmh!

    Should be...
    code:

    onClipEvent (load) {
    this.loadMovie("intro.swf");
    }

    this.createEmptyMovieClip("holder", 1);
    this.holder.loadMovie("intro.swf");


  11. #11
    Member
    Join Date
    Aug 2002
    Posts
    54
    Hey guys,

    quick quesitons -

    The whole empty clip thing worked great!! But how do I place a small movie clip that's in my main movie in level 2/3? (want this clip to be on top of the loaded clip but because it sees the movie clip as in level 0, it gets blocked by the loaded clip..

    next - this is on a movieclip and want it to play from it's frame 2 once it gets to this frame. What it does is stops on frame 2. why does it stop?

    onClipEvent (load) {
    gotoAndPlay(2);
    )

    thanks!

    Greg O

  12. #12
    Senior Member Pporksoda's Avatar
    Join Date
    Jul 2000
    Location
    baltimore
    Posts
    174
    Use swapDepths(); to change the depth of a movieclip.
    Code:
    _root.smallClip.swapDepths(3);
    Note that if there's already something in level 3, that something would swap to the original depth of smallClip.

    No idea why you gotoAndPlay(2); code isn't working. I would check frame 2 of that movie for any stray code that might be stopping it. Test around by having it start in frame 3 or 1 and maybe using a trace function to see where it's at.
    Code:
    onClipEvent(enterFrame) {
    trace("frame:"+this._currentframe);
    }

  13. #13
    Member
    Join Date
    Aug 2002
    Posts
    54
    Hey guys!!

    now i making a preloader that preloads the current movie but also want to pre-load a movie that is to be loaded and played later in this movie.


    onClipEvent (enterFrame)
    {
    if (this.percent == null)
    {
    loadMovie("tilegame.swf", _parent.shell);
    _parent.shell._alpha = 50;
    this.percent = 0;
    }

    this.percent = ((_parent.getBytesLoaded() + _parent.shell.getBytesLoaded())/(_parent.getBytesTotal()+_parent.shell.getBytesTot al())*100);
    this.bytes = _parent.getBytesTotal()+_parent.shell.getBytesTota l();
    this.loadedbytes = _parent.getBytesLoaded() + _parent.shell.getBytesLoaded();
    trace(_parent.getBytesLoaded());
    trace(_parent.shell.getBytesLoaded());
    trace(_parent.getBytesTotal());
    trace(_parent.shell.getBytesTotal());
    _parent.loadingtext = Math.floor(this.percent);
    _parent.loadingbar._x = (this.percent*5.8);
    if (this.percent == 100)
    {
    _parent.play();
    }
    }



    What is happening, is that it is loading the movie in the loadmovie section while holding up the first frame's content from loading, and when i trace the bytesloaded/total, it is just loading the current movie (and also the reason why the loading bar starts at 70 percent..)

    How can this be fixed??

    thanks so mUCH MAN!!

    Greg

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