A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: [RESOLVED] Error#2136 swf contains invalid data!!

  1. #1
    Instructional Designer
    Join Date
    Feb 2005
    Location
    Whidbey Island: north of Seattle, east of Victoria, south of Vancouver
    Posts
    299

    resolved [RESOLVED] Error#2136 swf contains invalid data!!

    Error: Error #2136: The SWF file file:///E|/Documents%20and%20Settings/Thomas/My%20Documents/FlashDevelopment/KeelSite.swf contains invalid data.
    at KeelSite/frame1()

    Trying to create a Flash project using only OOP. But I can't get past the errors.
    Here is the code on Frame 1:
    Code:
    import org.keelworks.containers.KeelSite;
    var mySite:KeelSite = new KeelSite();
    addChild(mySite);
    mySite.headerBox();
    The KeelSite.as file contains:
    Code:
    package  org.keelworks.containers{
    	import flash.display.Sprite;
    	//import flash.accessibility.Accessibility;
    	//import org.keelworks.utils.*;
    	/**
    	 * ...
    	 * @author Thomas Garrod
    	 */
    	public class KeelSite extends Sprite {
    		
    		public function keelSite() {
    			var blueBack:Sprite = new Sprite();
    			blueBack.graphics.lineStyle(3,0x243c54);
    			blueBack.graphics.beginFill(0x243c54);
    			blueBack.graphics.drawRect(0,0,1024,768);
    			blueBack.graphics.endFill();
    			blueBack.x = 0;
    			blueBack.y = 0;
    			addChild(blueBack);
    		}
    		
    		public function headerBox() {
    			var lightBack:Sprite = new Sprite();
    			lightBack.graphics.lineStyle(3,0xd3e7f2);
    			lightBack.graphics.beginFill(0xd3e7f2);
    			lightBack.graphics.drawRect(0,0,1024,100);
    			lightBack.graphics.endFill();
    			lightBack.x = 0;
    			lightBack.y = 0;
    			addChild(lightBack);
    		}
    	}
    }
    I've attached the files for your amusement. Any clues would be appreciated.
    Thanks,
    Tomas
    Attached Files Attached Files
    Tomas

  2. #2
    Senior Member jweeks123's Avatar
    Join Date
    Mar 2006
    Posts
    1,124
    Save your file in Flash CS3 format and I'll be happy to take a look.

  3. #3
    Instructional Designer
    Join Date
    Feb 2005
    Location
    Whidbey Island: north of Seattle, east of Victoria, south of Vancouver
    Posts
    299

    Thanks

    Thanks for the offer jweeks, but I do not have CS3. I have Flash8, but that does not accommodate AS3. Could you just cut and paste the code? What you see is what it is.

    Tomas
    Tomas

  4. #4
    Senior Member jweeks123's Avatar
    Join Date
    Mar 2006
    Posts
    1,124
    Interesting. Are you trying to do this in AS2? It's written like it's for AS3.

    What errors are you getting?

    Also, if it's in flash 8 I should be able to open it. The FLA wouldn't open though.

    Anyway, when I try to make my own file, it'll work if I put it in the proper location indicated by your package. You have to keep that same folder structure. Are you using that structure?

  5. #5
    Instructional Designer
    Join Date
    Feb 2005
    Location
    Whidbey Island: north of Seattle, east of Victoria, south of Vancouver
    Posts
    299

    miscom

    I mis-communicated. I have two versions of Flash 8 & 10. You are quite right. My files won't work in Flash 8. I'm pretty sure my problem relates to the code on my fla. I just did what someone told me to do. I don't understand that code, so that makes it suspect.

    My class file has two functions; one creates the background, the other creates the header container. What puzzles me is the need to use addChild on the fla when I've already done that in the class. I'll just need to study up.

    Tomas
    Tomas

  6. #6
    Senior Member jweeks123's Avatar
    Join Date
    Mar 2006
    Posts
    1,124
    Honestly that's one of flashes idiosyncrasies that we all kinda gotta get used to. It's odd I know but, let me try to explain it like this.

    Your calling the class, which adds children, but the class is out in space somewhere doing it's thing until, you tell flash to add it to your FLA file. So basically, flash says, hey, I have this class telling me to do stuff, but I'm not suposed to add it yet, so I'm not going to, and I'm not going to until I'm told to because this class extends Sprite and therefore is a sprite in my eyes.

    Make sense?

  7. #7
    Instructional Designer
    Join Date
    Feb 2005
    Location
    Whidbey Island: north of Seattle, east of Victoria, south of Vancouver
    Posts
    299

    Sense and sensibilty

    Yep. That does. The funny thing is that it is hard to find an explanation of the mechanics of this. I've seen explanations about classes in the abstract (e.g., how to create them and import them), but these classes are always utilities. I've seen none that use the drawing interface. Most examples add classes to a Flash file with visual assets.

    I feel like I'm at the door. I've got the key, but I'm not sure how to fit it into the lock.

    I've been able to make class files that I can test in an unsaved fla, but I had trouble with the path. I wonder if that still isn't the problem. I set up my file structure to match my site name (org>keelworks>folders).

    I just discovered that Essential ActionScript 3.0, Chapter 29 covers much of my puzzle (Moock is good, but he can be a bit odd in his information structuring). I'll read that right away and report the results today. I really have no business asking questions if I haven't done my homework.
    Tomas

  8. #8
    Instructional Designer
    Join Date
    Feb 2005
    Location
    Whidbey Island: north of Seattle, east of Victoria, south of Vancouver
    Posts
    299
    OK. If you are wondering how brilliant you have to be to generate this error, check this: I imported the class twice, once on the timeline and once on the properties>Class field. That will do it.

    I've been tearing my hair trying to figure out how to put my feet on the ground. Now I'm hoping to find something firm to pull my self up with; someday, I hope to walk!!
    Tomas

  9. #9
    Junior Member
    Join Date
    Mar 2014
    Posts
    1
    You should import class relative to .swf file either in property panel or in action script panel. Don't import in both. I have having same problem but it i Solved it this way.
    Thank you.
    Dinesh Gill Insan.

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