The New Face of the Blog

For years I was known as the #2 Flash guy in the world. In order to help others develop more quickly and stop banging their heads against the wall, I created this blog and filled it with answers to Adobe Flash errors. I will still leave up all the Flash errors for anyone that is looking but this new chapter of my life is going to focus on writing my book which is on how to be successful in Entrepreneurship. I’ve committed to several people that I will finish writing my book in 2017. So you will see the blog get a little makeover and start filling with content from my book.

That’s it for this post.

~ Curtis J. Morley

AS3 Error #3104: A SQLConnection must be open to perform this operation.

AS3 Error #3104: A SQLConnection must be open to perform this operation.

Description:
This AS3 error is really straight forward and easy to fix. It means that you have to open the Database before you can put anything in or take anything out. (or change anything). You cannot do any interaction with the DB without having it open. The solution is easy. Open the database before interacting with it.

Fix:
To fix AS3 Error 3104 make sure you have written this line of code dbConnection.open(dbfile); or dbConnection.openAsync(dbfile); If you have written this line of code then check where it sits in your ActionScript if it doesn’t sit above the first try-catch statement then you need to move it there. Placing the open(); call in the right place will resolve ActionScript Error 3104);

Bad Code:

try
{
statement.execute();
}
catch(error:Error)
{
trace(error.message);
}

dbConnection.open(dbfile);

 

Good Code:

dbConnection.open(dbfile);

try
{
statement.execute();
}
catch(error:Error)
{
trace(error.message);

AS3 Error 3104 is a straight forward AS3 error message, with a very easy fix.

As always Happy Flashing

Curtis J Morley

App used to work with AIR 3.2 or 3.4, doesn’t work with AIR 3.5 or 3.6

AIR 3.5 and 3.6 SDK for mobile require TLF Text to be merged into code.

Because I just spent the last full day dealing with this issue (without finding an answer on any forum) I thought I would share this so that you don’t have to bang your head against the wall. You probably found this page because your mobile project worked in AIR 3.2 or AIR 3.4 but when you try to publish your iPhone app or Android app using AIR 3.5 or AIR 3.6 SDK it  breaks.

This is the full error that I was getting when trying to publish from Flash CS6 using AIR 3.6:

Warning: Ignoring ‘secure’ attribute in policy file from http://fpdownload.adobe.com/pub/swz/crossdomain.xml. The ‘secure’ attribute is only permitted in HTTPS and socket policy files. See http://www.adobe.com/go/strict_policy_files for details.

TypeError: Error #1009: Cannot access a property or method of a null object reference. at startMeUp/firstRunAnim()[/Users/speedclimb/Documents/cjm/Flash/Mobile/MobileDev/STARTME/startMeUp.as:229] at startMeUp()[/Users/speedclimb/Documents/cjm/Flash/Mobile/MobileDev/STARTME/startMeUp.as:210]

Neither of these AS3 Warnings/ Errors make sense nor have any info to point you to a resolution. Don’t try and troubleshoot AS3 Error 1009 The problem is that Apple now requires that all of this is embedded. Adobe complied with the changes from Apple and because of this when creating a mobile app using AIR 3.5 SDK or AIR 3.6 SDK with TLF Text you must have the .swc “Merged into code”.

Solution:

In order to compile with AIR 3.5 or 3.6 SDK you have to do one of two things. You can change all of your TLF Text into “Classic” text. This works but is not ideal because then you lose all of the great formatting features of TLF Text. The better solution is that you change the “Default Linkage” in your ActionScript settings to “Merged into code”. Sounds complicated but it’s not. Go to File >> ActionScript Settings, when the dialog window pops up make sure you are on the “Library Path” tab and then change the drop down from “Runtime Shared Library” to “Merged into code”. Below is a screenshot showing how to solve this AIR 3.5+ SDK compiler issue. The important areas are highlighted in red.

Change the Default linkage from "Runtime shared library" to "Merged into code"

Change the Default linkage from “Runtime shared library (RSL)” to “Merged into code”

I hope this saves you 16 hours of brain damage trying to compile your code using AIR 3.5 or AIR 3.6 SDK.

As always Happy Flashing (for mobile)

Curtis J. Morley

 

AS3 ArgumentError: Error #1508

ActionScript3 Error 1508: The value specified for argument font is invalid

Description:
This ActionScript 3 error is caused by several different things. It can be a font embedding issue. It can be an issue with loading a font swf to the same location on a server. It can be several things. One of those reasons is easy to solve. This ActionScript error will show up when you have an incompatible font in  Flash or Flex. TLF text is great and most of the time you won’t run into error 1508. I have only ranAS3 Error 1508 once, thus this post.

Fix:
One simple fix is to specify a font that is compatible with TLF Text. In my case I was using TradeGothic LH Extended and BoldExtended. Flash didn’t like these fonts and threw out ActionScript Error 1508. If I scrolled up I also noticed that it gave me a very nice description of the error. It said, “The font named TradeGothic LH Extended is not compatible with TLF text. TLF text using this font will not display properly. Fonts should be embedded for any text that may be edited at runtime, other than text with the “Use Device Fonts” setting. Use the Text > Font Embedding command to embed fonts.” So as you can see I just needed to change the font to a compatible font and everything worked out fine.

AS3 Error 1508 is a complex AS3 error message, but in this case a very easy fix.

As always Happy Flashing

Curtis J Morley

Flash AS3 Error 1152: a conflict exists with inherited definition in namespace public

ActionScript3 Error 1152: a conflict exists with inherited definition in namespace public

Description:
This ActionScript 3 error is confusing by description but easy to solve. This error will show up when you have one or more names that are duplicated from a  Flash/Flex object to a variable within a class. The conflict error 1152 is referencing is between a variable in your class and an instance on the stage.

Fix:
To fix AS3 Error 1152 just change the name of a variable to something other than the name of a button or movieClip on the stage. (You can also change the name of the button to resolve ActionScript Error 1152) Basically make sure the names don’t match or you will keep getting AS3 Error 1152.

Bad Code:

Button on Flash stage named “isPlaying”

//ActionScript3 code that uses the same name as a variable
private var isPlaying:Boolean = false;

Good Code:

Button on Flash stage named “isPlaying”

//ActionScript3 code that uses the same name as a variable
private var isPlayingNow:Boolean = false;

AS3 Error 1152 is a confusing AS3 error message, but a very easy fix.

As always Happy Flashing

Curtis J Morley

Getting Rid of Shin Splints

I get shin splints. I have ever since I was on the San Rafael Junior High track team launching into the sand pit over and over again as a long jumper. Recently, my cousin Vaughn Jensen talked me into doing the original distance relay race Hood2Coast. So I have been running. I have been running pretty consistently. Even though I hated distance in high school and college I am really learning to love it. It is very therapeutic listening to the rhythm of my feet and feeling the air reach the very bottom of my bronchi as my lungs expand fully. Although I started to feel big improvements in most areas of my health, the more I ran the more my right shin hurt. It was getting worse with each run. The pain was bearable but consistently was getting worse with each consecutive run. I had to get an answer quick before the issue became to much. I asked everyone I knew that was into running and received some great answers.  Here is what I have done to control and even get  rid of my shin splints.

  • Compression socks – This has been the best thing for my shin splints. No longer does my condition worsen when I run. They really feel good when I put them on. I haven’t tried compression sleeves but some people prefer the compression sleeves to the compression socks. The sales person that I spoke with said that for long runs compression sleeves tend to cause the blood to pool in your foot where compression sleeves eliminate this issue. I purchased Swiftwick Men’s Twelve Aspire Socks. Not only do these ones feel great but they have a cool logo on the calf. The store recommended(slightly more expensive) socks are CEP Men’s Compression Running O2 Socks I have linked to both below as well as a pair of 2XU Compression Calf Sleeves.

  • Ice – After each run, long or short, I ice my shins. This instantly reduces shin splint pain and helps long term with the constant aches. I ice for 10 minutes after each run.
  • Alleve – If I am doing a long run I take an Alleve before the run to reduce inflammation. This serves the same purpose  as #2 but in a preventative way. I never take drugs or medication but this has been so helpful in reducing the inflammation and preventing the shin splint pain.

  • I also stopped running on my toes. I focused on my form and tried to have a proper foot placement.
My brother sent me this video that has also been a great help. It is from RunnersWorld.com and gives a great medical explanation from Dr. M

Make sure to watch the video. It is amazingly informative. Some of the info listed is:

  • Find the right fit in shoe. Look for a shoe that has arch support.
  • Take it easy. Don’t go to hard to soon.
  • Bone density. Eat food high in calcium and vitamin D to strengthen your bones.
  • Shorten your stride. Make sure to take 85-90 steps per foot per minute. This puts less load on the feet.
Hopefully this helps you with your shin splints.
– Curtis J. Morley

 

Flash Error #1006: addEventlistener is not a function.

ActionScript TypeError: Error #1006: addEventlistener is not a function.

Description:
This ActionScript error is wonderfully simple. It comes from calling something that you think is a function but Flash doesn’t recognize as such. Error #1006 can pop up for a different reason too. Make sure to see my first post on AS3 Error 1006 if the answer below doesn’t solve it for you.

Fix:
Look closely at the code above. In my case I just misspelled the native call to add an event listener. I typed addEventlistener with a lower case “l” instead of “addEventListener” with “L” capitalized. The fix is just to spell it correctly.

Bad Code:

blackBarFull_mc.addEventlistener(TouchEvent.TOUCH_TAP, navBack);

Good Code:

blackBarFull_mc.addEventListener(TouchEvent.TOUCH_TAP, navBack);

Easy Error, Easy Fix.

Related AS3 Error:
Flex / Flash Error #1006 value is not a function

As always Happy Flashing

Curtis J Morley

Flex / Flash TypeError: Error #1006: value is not a function.

ActionScript Error #1006: A user-defined namespace attribute can only be used at the top level of a class definition.

Description:
This ActionScript error will pop-up when a namespace is declared anywhere besides the class definition. What is a class definition you ask? It is simply the code that names the class – something like ‘public class MyClass’

After the class is defined you are allowed to create custom(or ‘user-defined’) namespace on that level. Anywhere else in the code is not legal. This ActionScript Error is closely related to the Flash/Flex error #1114.
This AS3 error may also just be a typo. you may have typed something like ‘publi class’ rather than ‘public class’ or ‘prvate function’ rather than ‘private function’

Fix:
Either fix the misspelling in your code or place the ‘user-defined namespace’ inside the class definition. The second code example shows a namespace to separate cars and animals. Notice how the bad example nested the ‘user-defined namespace’ inside the constructor function.

Bad Code 1:

package com.cjm.somepackage
{
publi
class MyClass {
publi
function MyClass() {}
}
}

Good Code 1:

package com.cjm.somepackage
{
public
class MyClass {
public
function MyClass() {}
}
}

Bad Code 2:

package
{
public class MyClass
{
public namespace Cars;
public namespace Animals;

public function MyClass()
{
Animals var Jaguar:String = “A large cat chiefly of South America”;
Cars var jaguar:String = “A large car chiefly driven in North America”;
}

Cars function run():void {
trace(“At $30/mile”);
}

Animals function run():void {
trace(“On four legs”);
}
}
}

Good Code 2:

package
{
public class MyClass
{
public namespace Cars;
public namespace Animals;

Animals var Jaguar:String = “A large cat chiefly of South America”;
Cars var jaguar:String = “A large car chiefly driven in North America”;

public function MyClass()
{

}

Cars function run():void {
trace(“For 100,00 miles”);
}

Animals function run():void {
trace(“On four legs”);
}
}
}

Adobe has a great explanation of how to use namespaces as well as Collin Moock in Essential ActionScript 3 in Chapter 17

Related AS3 Error:
Flex / Flash Error #1006 addEventlistener is not a function

As always Happy Flashing

Don’t need to Get Tickets for the Late Show and Newsies because Letterman is IN Newsies.


At first we felt really lucky that we got tickets to the Late Show, Statue of Liberty night cruise, and Newsies while we are in NYC. But then we found out that we could have seen Dave in his new leading role in Newsies and saved the money for the Late Show. (Late Show has free admission btw)