A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Augh!

  1. #1
    file not found Captain_404's Avatar
    Join Date
    Apr 2006
    Posts
    457

    Augh!

    I've been working on this problem for about the past 3-5 hours strait, and nothing I'm doing is working or even remotely making sense.

    I'm making a level editor for my game Valo (link in my sig), and I want it to have the ability to edit levels and test those levels.

    The making and testing works fine, but if you should return to edit the level, the array reverts back to all zeros for some reason., I've tried "saving the arrays in another variable, but somehow, both revert to zero, it doesn't matter where it is, on a mc, on the main timeline, on an mc inside an mc...

    I'm so distraught and confused!

    From what I can tell, it reverts back to zero sometime after it is constructed in the testing "field", somewhere around the second frame timewise...



    Does anyone have an idea what I'm doing wrong?



    http://ian.janasnyder.com/editor.htm
    Attached Files Attached Files

  2. #2
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    just wanted give a hind that on TFT´s here the colors are almost not visible unlike the CRT monitors

    maybe you haven´t declared the array propper like:
    myArray = new Array();
    myArray[0] = new Array();
    myArray[0][0] = "test";

  3. #3
    Actionscript 3, postproduction georgecalgary's Avatar
    Join Date
    Jun 2005
    Location
    Toronto
    Posts
    229
    Some hard to read all the code.

    As you said after you return they're all zero. I checked you 'back' button code:

    on (press) {
    removeMovieClip(_root.tiles);
    _root.gotoAndStop(2);
    myMap1 = iHold;
    }
    The code is questionable as you called a variable 'myMap1', I guest your variable 'myMap1' is belong to the main timeline so it wouldn't work for you.

    You should add this.
    _root.myMap1 = iHold;

    Not sure where your 'iHold' come from. If it's in the _root.
    _root.myMap1=_root.iHold;

  4. #4
    Style Through Simplicity alillm's Avatar
    Join Date
    Mar 2004
    Location
    Wales
    Posts
    1,988
    If you make an array like..

    myArray = [0, 0, 1, 2, 3];

    and then make a copy like..

    myArray2 = myArray;

    Then any changes you make to the copy will be made to the original too (at least I think thats right, havent had this problem in a while).

    So if you then say..

    myArray2 = [0, 0, 0, 0, 0];

    then the original array will also be set to zeros. This could be your problem.

    Hope thats clear.

    Ali

  5. #5
    file not found Captain_404's Avatar
    Join Date
    Apr 2006
    Posts
    457
    After five hours of trying to figure out this problem, I post this thread, take a break, and then it hits me. Of course. It always happens right after you ask for help...

    But thanks so much everyone who did help, I did learn something to say the least.



    My problem was that the tiles, when they were created, declared themselves to be zero and changed it to be so in myMap1. This was happening even before the loop that places the tile could change their frame. So, I just delayed that action a couple of frames.

    But thanks again to everyone who helped and especially to those who attempted to wade through my messy messy coding.

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