A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Sprite Sheet Script

  1. #1
    Junior Member
    Join Date
    Oct 2009
    Posts
    7

    Sprite Sheet Script

    So I found a nifty little video that shows how to use AS2.0 to make a sprite sheet that can then be used to allow flash graphics in XNA. However, after copying the code it doesn't seem to want to work for me.

    Here is the video http://www.youtube.com/watch?v=UfZuBY_DAB4

    Here is the code:

    Code:
    cellWidth = 100;
    cellHeight = 150;
    max = 10;
    
    for(i = 1; i<=4; i++)
    {
    	mc = _root.attachMovie("hero", "hero" + i._root.getNextHighestDepth());
    	
    	mc._width = guy._width;
    	mc._height = guy._height;
    	
    	mc._x = (i-Math.floor((i-1)/max)*max)*cellWidth + 100;
    	mc._y = Math.floor((i-1)/max)*cellHeight + 100;
    	
    	mc.gotoAndStop;
    }
    And I will provide a copy of the file I was working with.

    I was applying the code to the Weapon Fire movie clip in the project file (it's the only one with any type of animation), but it didn't work. I tried applying it to the timeline as well, that didn't work either. If somebody could tell me what I'm doing wrong I'd appreciate it :P
    Attached Files Attached Files

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    mc.gotoAndStop; is wrong. gotoAndStop need a parameter. Like mc.gotoAndStop(label variable or frame)

    gparis

  3. #3
    Junior Member
    Join Date
    Oct 2009
    Posts
    7
    Ah thanks so much. I was able to get it working. I meant to put gotoAndStop(i); not just gotoAndStop;.

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