Saturday, November 8, 2014

Test Object for static method AS3

var obj:Object = new DecalMetaDatumLE();
            var str:String = getQualifiedClassName( obj );
             var def:Class  = getDefinitionByName(str) as Class;
           
            if (def["toJSONText"] != null)
            {
                trace("call it!");
            }


Still not sure how to list off all the static methods of a class.
But this is all I need for now. The ability to check for an object having a static method.
Making an advanced JSONEncoder where all complex data types can specify a
"toJSONText" and "fromJSONText" public static method that my JSONEncoder and JSONDecoder
will look for to better serialize complex objects.

Thursday, September 25, 2014

Adobe Flash Player 10.0 r2 has stopped working


I had to painstakingly trace through all my code until I found where the crash was happening.
The offending line?

trace(this);

I've been noticing that I get weird hard to find bugs every time I target a different version of flash.
Which now makes me know why I have testers who are reporting weird crashes that I cannot replicate.

-MakeGamesHappen
(-John Mark)

Thursday, July 17, 2014

VerifyError: Error #1014: Class flash.ui::GameInput could not be found.

https://github.com/HaxeFlixel/flixel/issues/901

Answer:
Yeah.. I expect we're gonna get this a lot from now on.
We added flash gamepad support, which requires flash player version 11.8+. So there are two things you can do:
  1. Increase the flash player version accordingly: <set name="SWF_VERSION" value="11.8" />
  2. Disable gamepads on flash: <haxedef name="FLX_NO_GAMEPAD" if="flash"


    Hopefully I don't run into this problem because I will be converting my old as3 code base to haxe.
     


OpenFL is not a recognized internal or external command:


 Hmm... The lime thing worked for me. But didn't have as many sample projects as I was hoping for.
Think my next step is to download HaxeFlixel and run those sample projects and get them running on different targets.


Making blog posts of trouble shooting as I go on my journey to get Haxe and OpenFL
rolling. :)

http://www.openfl.org/archive/community/installing-openfl/openfl-not-recognized-internal-or-external-command/

Instead of "openfl create DisplayingABitmap", try "lime create openfl.DisplayingABitmap", and so on. We'll try and get the documentation updated.
http://www.openfl.org/archive/profile/1/  <<stalk this guy.




I got this issue solved by running haxelib run openfl-tools setup
I dont remember if it is istalled by default (check by running haxelib list), if not - run haxelib install openfl-tools

Flash is dying, should I use unity?


Flash is dying.
Should I go to Unity?
No!!!

Adobe is killing flash, and look what happened with XNA.

Sure, Unity will be good for 5 or 10 years. But I am in this for longer term that that.

I don't want to be a slave to proprietary platforms, being forced to spend all my time
converting code every time technology changes.

I've been thinking about this for over six months.

This resource is pretty good:
http://haxe3.blogspot.com/2013/07/getting-started-with-haxe-3-and.html

Also, a year ago I compiled some Haxe and it worked. I can't say that for every
platform I have tried. Only reason I didn't go with it then was I wasn't sure it
had been around long enough to be safe.

Now I am sure it is.

-MakeGamesHappen
(-John Mark)

Trouble shooting notes for:
http://haxe3.blogspot.com/2013/07/getting-started-with-haxe-3-and.html

Need to install the other packages with these commands:
haxelib install openfl setup
haxelib run openfl setup
haxelib install openfl-compatibility
haxelib install openfl-html5
haxelib install openfl-native
haxelib install openfl-samples
haxelib install openfl-tools
haxelib list

New problem:
Debugging and running flash target.
This file does not have a program associated with it for performing this action.
Please install a program or, if one is already installed, create an association
in the Default Programs control panel.

Thursday, April 3, 2014

Flash Develop: Could Not Open [...] lib\i386\jvm.cfg'

<pre>
I recently MANUALLY installed JAVA by cutting and pasting my java installations from my C:\DEV\JAVA folder of a machine I recently fried via emptying mountain dew into the keyboard.

I have installed FlashDevelop and Java more times than I can count.
As usual, I ran into some trouble.






Before I tell you, it is important to note the layout of my files:
With flash develop, you MUST use the 32 bit version of Java.
C:\DEV\Programs\JAVA\JDK6_32BIT
C:\DEV\Programs\JAVA\JRE6_32BIT

Here is what I did:

To get flash develop to know where java is, add this to your PATH variable:
C:\DEV\Programs\JAVA\JDK6_32BIT\bin\
Aka: Whatever bin folder contains BOTH "java.exe" and "javac.exe".

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!







TO GET RID OF "Could Not Open [...] lib\i386\jvm.cfg" ERROR:
YOU WILL NEED TO ADD THE JAVA_HOME VARIABLE:
JAVA_HOME == C:\DEV\Programs\JAVA\JRE6_32BIT
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Also: Tips on the internet say check system32 for copies of Java that were not deleted during a previous un-install.

I recommend making a shortcut to environment variables if you are a developer.
You will be using them often. Especially when setting up new development environments.

For my Windows 7, the shortcut should point to:
%windir%\System32\rundll32.exe sysdm.cpl,EditEnvironmentVariables
</pre>

Saturday, September 14, 2013

With is not the only way to shorthand in AS3

var arr:Array = new Array();
var p:Function = arr.push;
   
p("hello");
p("whats up?");
   
for each(var s:String in arr){trace(s);}

Monday, July 29, 2013

Intellesense Recognizes imports but FlashDevelop compiler does not

After about an hour of trouble shooting why my AS3 game project compiles on my old computer, but NOT on my new computer... I finally figured it out. The older version of FlashDevelop let me get away with this: A file named: FlxTileMapEXT.as Inside the class: [...] public class FlxTilemapEXT extends FlxTilemap [...] When I imported and used the class: import FlxTilemapEXT Everything worked... But on my new computer it kept saying that the definition "FlxTilemapEXT" could not be found. See the problem? Answer: Case sensitivity. My file name is FlxTileMapEXT, but it defines a class FlxTilemapEXT. FlxTileMapEXT != FlxTilemapEXT However, the old version of FlashDevelop let me get away with this. SIDE NOTE RELATED TO HAXE: NOTE: Haxe compiling in flash develop is even stricter. Avoid underscores in your file names. Also, avoid folders that start with CAPITOL letters, as it will short-circuit import statements. The compiler will think the folder is a class.

Thursday, July 18, 2013

Hide Flixel Mouse and Show System Cursor

I combine my Flixel games with a UI layer on TOP of the Flixel Game Sprite. Because of this, it is necessary to use the system cursor, so that the UI layer is not drawn on top of my cursor. One way to do it: myFlxGameInstance.useSystemCursor = true; //set to true to make sure FlxG does not undo your changes when you switch states. FlxG.mouse.hide(); //Hide the Flixel mouse. flash.ui.Mouse.show(); //Show the standard system cursor Or: You can specify to use the system cursor in the constructor of your FlxGame instance. But if for some reason you want to change things later. The above is how you would do it.

Saturday, May 25, 2013

InfinityBomber76

[ UPDATE: 2013.07.28: SWF FILE REMOVED. Have decided to keep game off internet until it is finished and copyrighted. ]

Tuesday, May 14, 2013

Static Initializers In Haxe

http://haxe.org/doc/snip/initialization_of_statics Unlike in AS3, it doesn't look like you can have unlabeled brackets in the beginning of a class to put static initialization code. Here is a way to statically initialize something:
public static var NUMBERS = {
    var a = new List();
    for (i in 0...10) a.add(i);
    a; // result of last block expression is saved in NUMBERS
}

Monday, May 13, 2013

Function Types In Haxe

http://stackoverflow.com/questions/14025739/passing-a-function-as-a-parameter-in-haxe

 // fType : T -> Void
 // argument means that it takes a function "fType"
 // that takes one argument of type "T" and returns Void.
 public function applyFuncToAll( fType : T -> Void ):Void
 {
  cur = first;
  while (true)
  {
   //Call bound function on current object in list.
   fType( cur.obj );
   
   if (cur.hasNext)
   {
    cur = cur.next;
   }
   else
   {
    break;
   }
  }
 }

Sunday, May 5, 2013

CS5 crashes on startup or new file creation

Looks like the solution to getting my CS5 programs working again is the removal of bad network printers.

Saturday, May 4, 2013

Packages and Imports in Haxe

Unlike in Actionscript, it looks like you must conform to the "Constant-Class" rule when naming packages.

--Notes------------------
The class path:
import com.JMIM.TestClass;

Gave me an error "Unexpected com" or something like that.
I thought it might be namespace collision since the NME library also has a com folder so I tried:
import dotCom.JMIM.TestClass;

And changed the folder structure accordingly only to end up with the same error.

During this whole time I did make sure to add my personal library by putting another source path tag into the .nmml file.

Then I started getting errors something along the lines: "Unexpected class JMIM" or something.

I changed it to:
import dotCom.jmim.TestClass;

Getting closer to a compile. :)
Also, it looks like restarting my computer after messing extensively with the package structure MIGHT
be the way to go once you've done everything you can think of.
--------------------------

Thursday, May 2, 2013

AppTopia

Market Plan: 1. Make source code. 2. Re-skin game over and over till it stops making money. 3. MAYBE sell source code on internet. Make at least 3 skins of each game. Do NOT take advantage of artists. Offer artists a FLAT commission rate and 50% of whatever the profit is from the game. Pitch to artists: 1. Guaranteed Cash. Half now, half when you finish. 2. 50% on whatever the game makes. 3. There WILL be a credits section. You may use it as a portfolio piece. This could help you with a full time job, or just to brush up on your skills.

Wednesday, May 1, 2013

How to add library in Haxe / NME / NMML

Adding library in Flash Develop Haxe:
<!-- Paths to libraries. Must be declared here. Not in the project properties. -->
<source path="Source" />
<source path="C:\Users\JMIM\Desktop\HAXELIB" />

Sunday, April 28, 2013

Haxe Flixel Links

Links for my research: Tutorial: http://dustytome.net/moot/2012/08/haxe-flixel-platformer-tutorial/ Get HaxeFlixel source code: https://github.com/Beeblerox/HaxeFlixel TODO: Get $Haxlib install HaxeFlixel Working on .cmd Haxlib Setup: http://haxe.org/com/haxelib/setup Problem with Haxe Flixel: C:\Motion-Twin\haxe\lib\HaxeFlixel/0,9,0a/org/flixel/FlxText.hx:24: characters 17-52 : You cannot override properties

Wednesday, March 20, 2013

added to my list of people to stalk

IK Solver in AS3:
http://vimeo.com/23191399
http://www-scf.usc.edu/~shopkins/contact.html

also
http://www.adobe.com/devnet/flash/articles/spring_tool.html

Trig rounding errors in AS3

Maybe I just don't know my trig...
But if I do...
The difference between 1.888 and 1.253 is a HUGE rounding error.
var m:Number = Math.asin( Math.sin(1.888) );
//m = 1.253
http://answers.yahoo.com/question/index?qid=20080227172624AAwIQZA

Thursday, March 14, 2013

Iterate through quadrants

This is ridiculous:
var xo:int; //x offset.
    var yo:int; //y offset.
    var i2:int;
    var z0:int;
    var z1:int;
    var zeroMaybe:int;
    for (var i:int = 0; i < 4; i++)
    {
     zeroMaybe = (i < 2) ? 0 : 1;
     i2 = i + 1;
     z0 = (i &  1);
     z1 = (i2 & 1);
     xo = (z0 + (-1 * z1))  * zeroMaybe;
     yo = (z1 + ( -1 * z0)) * (1-zeroMaybe);
     trace("debug");
    }
Guess I should just put the pairs into a vector. Trying to iterate over checking 4 positions relative to a tile: UP,DOWN,LEFT,RIGHT. By outputting the correct offset values each iteration: [0,1] [0,-1], [1,0], [-1,0] in no specific order. Actually... This isn't bad for building a lookup table that is a linked-list. Same thing said another way:
for (var i:uint = 0; i < 4; i++)
   {
    var and3:uint = i & 3; //OUTPUT: 0,1,2,3  0,1,2,3
                          //OUTPUT in BINARY:  00, 01, 10, 11
           //If we SUBTRACT the bits, we can get 0,-1,1,0. Just what we need.
    var a3  :uint = (i + 2) & 3; //same as and3, but input is shifted over two.
     
    //When and3 and a3 are converted to -1,1,or zero, we will have the following outputs in this order:
    // [0,1] , [-1,0], [1,0], [0,-1] ALL THE KITTY KORNERS.
   
    var npX:int = ((and3 & 2)>>1) - (and3 & 1); //convert number 0-3 to: 0,1,-1
    var npY:int = ((a3   & 2)>>1) - (a3   & 1); //convert number 0-3 to: 0,1,-1
    
    //Building linked-list table of offset quadrant values:
    cur.x = npX;
    cur.y = npY;
    if (i != 3)
    {
     
     cur.hasNext = true;
     cur.next = new LinkedXYPair();
     cur = cur.next;
    }
    
    trace("debug: [" + npX + " : " + npY + "]");
    
   }