dcsimg
A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: Load Movie problem i posted some time ago

  1. #1
    DOT-INVADER marmotte's Avatar
    Join Date
    May 2002
    Location
    Dot-Switzerland
    Posts
    2,601
    maybe you remember, i posted a while ago a first version of my fighting game (i'm still working hard on it), and the characters were .swf files loaded in the main file. unfortunately, it didn't work at all, and i just found out why...

    maybe it will help you not to do the same mistake (if that's a mistake ^^)

    ok, in my previous version, the external files were loaded in a MC, method that didn't worked, or workd more or less (in fact, i had mixed results).
    now, i just tried to load the same external files not in an existing MC, but in another level (ie _level2), and it works perfectly (at least for me).

    i was also wondering if you had a same kind of problem, or maybe if i have to adjust something, i don't know... maybe the first method i tried doesn't match with online...?

    mmmh i have a very newbie question, shame on me
    > now my external files are loaded in different levels. so i target them like that, for example:
    _level1.character.gotoAndStop("hadoken")

    but, how can i write:
    _level(SpecifiedValue).character.gotoAndStop("hado ken")
    "SpecifiedValue" being a variable that equals 1?
    i tried different things like
    _level[SpecifiedValue].character.gotoAndStop("hadoken") or
    _level[SpecifiedValue+"character"].gotoAndStop("hadoken")
    but it never worked (i'm sure the solution is so easy, shame on me, shame on me...)

    thanks for your help


  2. #2
    I'm feeling supersonic kdsh7's Avatar
    Join Date
    Jul 2002
    Posts
    356
    maybe somthing like;

    var levelvar="_level"+x; //where x is your variable

    then;

    [levelvar]character.gotoAndStop("hadoken");

    not sure though - but give it a go

  3. #3
    DOT-INVADER marmotte's Avatar
    Join Date
    May 2002
    Location
    Dot-Switzerland
    Posts
    2,601
    i also tried that way, with no success...

    the sample code to change:

    Code:
    if (_level1._currentframe == 4) {
           _level1.gotoAndStop("LoadingCharacters");
    }

  4. #4
    I'm feeling supersonic kdsh7's Avatar
    Join Date
    Jul 2002
    Posts
    356
    just tested it and it works..ah i missed out the _root

    _root[levelvar].gotoAndPlay("whatever");

  5. #5
    DOT-INVADER marmotte's Avatar
    Join Date
    May 2002
    Location
    Dot-Switzerland
    Posts
    2,601
    _root...?
    oh, i didn't know i have to add the "_root" text...
    so, it's like saying _root._level2.goto... mmmhhh

    thanks a lot kdsh7 ^^

  6. #6
    I'm feeling supersonic kdsh7's Avatar
    Join Date
    Jul 2002
    Posts
    356
    using your example:


    var levelvar="_level"+marmottevariable;
    if (_root[levelvar]._currentframe == 4) {
    _root[levelvar].gotoAndStop("LoadingCharacters");

    }

    that should work - just tested it

    also, how do you do that formatting for the code?

  7. #7
    I'm feeling supersonic kdsh7's Avatar
    Join Date
    Jul 2002
    Posts
    356
    glad to help - anything that helps you work faster. I'm really looking forward to your game!

  8. #8
    DOT-INVADER marmotte's Avatar
    Join Date
    May 2002
    Location
    Dot-Switzerland
    Posts
    2,601
    ^^ thanks
    yes, your code works.

    well, it seems it's not my day today... another one:

    _level1.LifeBarPlayerOne._xscale-=1

    >
    var LifebarLevel="_level1";
    _root[LifebarLevel].LifeBarPlayerOne._xscale-=1 //this one is ok

    >
    and now, how to put that with:
    var LifebarLevel="_level1";
    var WhichLifeBar="LifeBarPlayerOne";

    do you have an idea? i still tried different writings, but... no success

    about my game, it's still progressing...
    what i have to do is:
    - protection system (you can protect when the enemy is attacking)(already done a part of it)
    - better combo system (the one i have is working, but still i want a real snk-like game ^^)
    -enemy's AI (mmmhhh... i'll have to find the most efficient way, since all characters will have very different moves)
    and some other details, that are not so minor when it comes with the huge amount of move possibilities...

    of course, any help will be welcome ^^
    i'll put a new version online soon, but now i have to rewrite the target thing for the characters, since they are not loaded in the same place as before...

  9. #9
    Illuminatus! fospher.com's Avatar
    Join Date
    Jan 2002
    Location
    5th Dimension
    Posts
    2,185
    marmotte, dont u think _width would work better than _xscale? i mean if _xscale of the healthbar < 0 then it will start going the other way - but if width<0 it will stay as zero...

  10. #10
    gskinner.com
    Join Date
    Feb 2002
    Location
    N.America
    Posts
    455
    var LifebarLevel="_level1";
    var WhichLifeBar="LifeBarPlayerOne";
    _root[LifebarLevel][WhichLifeBar]._xscale-=1

    And just FYI, I have never encountered any problems with loading swfs into MC instances. In fact, that's how my game worked. But whatever works for you is best for you.

    Cheers,
    ZE.

  11. #11
    DOT-INVADER marmotte's Avatar
    Join Date
    May 2002
    Location
    Dot-Switzerland
    Posts
    2,601
    fospher.com

    ok, i'll give it a try. but that's true, with _xscale, the value can be negative... unless you specify not to, of course. in fact my health bar is "progressive": i mean, if you hit the opponent with a strenght value of 5, the health bar doesn't go down 5 pixels, but progressively (1 pixel at the time). of course the processus is stopped as soon as it reaches 0. do you understand? ^^

    zeroEra

    thanks for the code, i'll try it (mmmh, but i'm sure i already tried that form before posting).
    and about the load MC in another MC, i really prefer to do it instead of using levels... but for now it didn't work for some people (for me it worked, exept the loading bar was... fantasist). mmh were you using the basic LoadMovie method?

    about my game, current status: i'm coding the AI (before having finished all the keys interactions) it seems... good. maybe not good, but it's becoming interesting.
    just to let you know, i'll probably post several functions open source, that way (and since i'm not an expert coder) you'll have the opportunity to use it, and maybe improve, it would be great. anyway, i'll post my game in several days probably. thanks for all your help, everyone ^^

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