Flex / Flash ActionScript Error #1065

ActionScript Error #1065: Variable MyClassName is not defined.

Description:
This ActionScript error means that Flash or Flex does not understand the definition of your Class. One reason for this is that you forgot to declare your class as public. Another reason is that the reference is not correct. Don’t be deceived by the word Variable in this error it is really a class.

Fix:
Add public before the name of your class.

Bad Code:

class MyClassName extends MovieClip

Good Code:

public class MyClassName extends MovieClip

Fix 2:

Correctly reference the class that is being used.

Good luck trouble shooting ActionScript Error #1065 and,
As always Happy Flashing

New info on ActionScript Error #1093

I have posted new 3 more fixes for ActionScript Error #1093. Thanks to grildCheese for leaving the comment about fix #3. You can view AS3 Error #1093 here. This Flash error is absolutely nondescript so read this fix and instead of going nuts trying to fix it.

Thanks and Happy Flashing.

SWFObject.addVariable() in AS3

SWFObject.addVariable() in AS3

SWFObject is the standard for embedding Flash files into HTML. If you haven’t used it run on over to Geoff Stearns site and download yourself a heapin’ helpin’ of some SWFObject. If you are feeling especially adventuresome and want to test out the latest features in the new SwfObject 2.0 then head over to the SwfFix development blog. SWFObject eliminates the need to click on the Flash piece on a website before being able to interact with it, it has plug-in detection, it can be used with popular blogging software on sites such as this, and there are plugins for Dreamweaver and as a publish setting right in Flash. You should be using this for every website you build.  As of the 15th of February (I wonder what they were doing on Valentines Day) you can even download an SWFObject Adobe Air app for generating the proper code to embed your SwfObject into your website.  It employs the new SWFObject 2.0.  Or for quick and easy access just use the web version to generate your swfObject code

Now that you are totally sold and will never build anything Flash without it, you may want to inject variables (FlashVars) into your swf.  The methods are different for AS2 and AS3.  It is quite easy, yet different in each of these versions of ActionScript.  You simply throw the following code into the HTML and then …

<div id=”flashcontent”>
Swf Audio is not loaded Please check your path. this should be an audio control built in flash.</div>

<script type=”text/javascript”>

var so = new SWFObject(“SoundControlTest2.swf”, “audioControl”, “240”, “24”, “8”, “#EFECDD”);
so.addVariable(“audioURL”, “AllThatIWant.mp3”);
so.addVariable(“audioURL2”, “Comfort.mp3”);
so.addVariable(“audioURL3”, “Jolene.mp3”);
so.addVariable(“audioURL4”, “Amazing.mp3”);
so.write(“flashcontent”);
</script>

…then in your Document class (or on the MainTimeline if you are not using a Document Class) you will need to reference the parameters property of the loaderInfo property like this:

myTextBox.text = this.loaderInfo.parameters.audioURL;

In AS2 you only can access the variable directly on the mainTimeline using something like this:

myTextBox.text = audioURL;

Hope this helps you (and your users) have a better Flash experience on the web.

As always Happy Flashing.

Curtis J. Morley

Flex 2 / Flash CS3 ActionScript Error #1105

ActionScript Error #1105: Target of assignment must be a reference value.

Description:
This ActionScript error simply means that you are trying to assign a value to something that is already a value and not a variable or a writable property. Adobe Live Docs actually has a pretty good definition about this one. It says, ” You can assign a value to a variable, but you cannot assign a value to another value.” To make this simple let me use an example. An array has a property length. An XMLList also has a property called length() . Pay attention to the parenthesis. An array will let you change the length of the array simply by calling my_array.length = 2; because it is a readable and writable property. When using XML however the length property is only readable so my_xml.length() = 0; is like saying 2 = 0; You can not change the value 2.

Fix:
When you get this ActionScript error make sure to check that you are not trying to change a value. Also make sure that the property is readable and writable.

Bad Code:

my_xml.children().length() = 0;

Good Code:

package{
	public class MySize {
		private var size:uint = 40;
		protected function Connection():void{
			trace(size);
		}
	}
}

Good luck trouble shooting ActionScript Error #1105 and,
As always Happy Flashing

Last Minute Valentines Day Gift – Heart Attack

Valentine – Heart Attack Maker

Are you having a heart attack because you didn’t order flowers a week ago? Well calm your beating heart and give your Loved one a heart attack instead. Just fill in your name and your loved ones name below and from your printer will come many Valentines Hearts that you can cut out and put on your love’s car walls, mirrors, house, etc… I suggest putting red, pink or bright pink paper into your printer but white will do. Each Valentines heart comes out with a unique saying.

Flash application that prints multiple Valentines hearts, each with a personalized Valentines saying. Create your own valentines. Give your love a heart attack(the good way).

Have fun and spread the love.

ActionScript Error #2032

ActionScript Error #2032: Stream Error. URL: /Sound/Amazing.mp3

Description:
This is an ActionScript Runtime Error that you will get if you purposefully trap errors (which I highly recommend you do) while trying to load a file into Flash/Flex. One very simple reason you will get this error is if you have targeted an mp3 or any file incorrectly. This can include php scripts and other external datasources.

Fix:
Make sure that you are targeting the file correctly. In the ‘Bad Code’ example below I am missing just one letter. Without trapping the errors like I do you will also get AS3 Error #2044: Unhandled IOError Event

Bad Code:

private var snd:Sound = new Sound();
snd.load(new URLRequest(“Amzing.mp3”));
snd.addEventListener(IOErrorEvent.IO_ERROR, onSoundIOError, false, 0, true);

function onSoundIOError (e:IOErrorEvent)
{
trace(“An Error Occured and it looked like this.”, e.text);
}
snd.play();

Good Code:

private var snd:Sound = new Sound();
snd.load(new URLRequest(“Amazing.mp3”));
snd.addEventListener(IOErrorEvent.IO_ERROR, onSoundIOError, false, 0, true);

function onSoundIOError (e:IOErrorEvent)
{
trace(“An Error Occured and it looked like this.”, e.text);
}
snd.play();

Error #2044: Unhandled IOErrorEvent:. text=Error #2032: Stream Error.
at SoundControl_fla::MainTimeline/frame1()

Related ActionScript Errors – AS3 Error 2044 Unhandled IOError Event

This ActionScript Error is a quick one. I hope this helps you solve it.

As always Happy Flashing