FlashPaper Component 0.8Updated my FlashPaper component to add color schemes for the FlashPaper interface.

Surprisingly enough, I actually get a lot of hits on this site for my FlashPaper component.
What’s funny is that I’ve never once thought about charging for it, but today I realized that another company was charging an outlandish amount of money for much less functionality.
The company is Zanzibar Fiction and here is their pricelist. And yes… that’s up to $500 that they’re charging for deactivating the select and print buttons!! I just don’t get it.
But anyway, one thing that they added that my component didn’t have was color schemes for the FlashPaper interface. So to hopefully prevent anyone from spending that crazy amount of money, I decided to add it to my component… but make it even better. They offer 8 color choices (and they are all very ugly) and my component now lets you select any tint color and percentage that you like for the interface.
Oh and by the way it’s still free! :)

Description:
The FlashPaper component simplifies the process of working with the FlashPaper API and adds functionality either not documented or not provided in the API.

Installation:
- Unzip FlashPaper_0.8.zip
- DoubleClick on FlashPaper.mxp to install with the Extension Manager.

Documentation:
FlashPaper Component Documentation

Download FlashPaper

Posted in AIR, Flash | 43 Comments
Associating Custom AS3 Classes with Embedded AssetsContrary to popular belief, it is possible to associate a custom class with an embedded symbol and here's how to do it.

Keith Peters had a couple of posts a little while ago about embedding assets in as3 (1 and 2). One thing that came up in both of them that could not be resolved was how to associate a custom class with an embedded symbol. The example given was:

…create a movie clip in the Flash 9 IDE, give it a class of “Star”, and you have an actual class written, called “Star” that has some functionality that is really cool. Now, you embed that star symbol in your AS3 application, but you can only type it as Sprite or MovieClip. How to get it to be a “Star”? I finally got to dig in to this a bit more, and sadly, I don’t think there is a way to do this. When you embed a Sprite asset, it comes in as an instance of SpriteAsset

I was trying to do the same thing and found out that there actually is a way to do this. Instead of adding the embed tag above a variable like so:

package
{
	import flash.display.Sprite;

	public class Application extends Sprite
	{
		[Embed(source="library.swf", symbol="Star")]
		private var Star:Class;

		public function Application()
		{
			var star:Sprite = new Star();
			addChild(star);
		}
	}
}

…which only allows you to type it as Sprite or MovieClip. You can instead create the Star class and add the embed tag directly above the class declaration:

package
{
	import flash.display.*;

	[Embed(source="library.swf", symbol="Star")]
	public class Star extends Sprite
	{
		public function Star()
		{
		}
	}
}

and implement it in the main class with:

package
{
	import flash.display.Sprite;

	public class Application extends Sprite
	{
		private var star:Star;

		public function Application()
		{
			star = new Star();
			addChild(star);
		}
	}
}

Now you have a custom Star class you can do anything you want with associated with an embedded asset!
Yay! Problem solved.

Posted in Flash | 20 Comments
FlashDevelop 3 Prerelease Test DriveI decided to compile the source for FD3 and see how the new version is coming along.

Since its been quiet on the FlashDevelop front regarding version 3, I decided to update the repository and see if I could compile the source to see the progress. First things first, with FD2 you could compile it with SharpDevelop version 1.1 (for .NET Framework 1.1), but to compile FD3 you need to use MS Visual C# Express Edition (for .NET Framework 2.0). I’m not positive, but I would assume you could also use version 2.1 of SharpDevelop.

Once Visual C# was installed, I built the solution and everything compiled with no problems.

So now to see what’s new (noting that this is not a release at all, so I am expecting bugs and a completely unpolished product):

- Once open, FD3 looks very similar to the layout of FD2 except slightly slicker. A little more gray that once was white and an added gradient to the toolbar.

- The tabs on the documents have a corner bent down instead of the straight squares they were in FD2 which makes it a little more obvious which tab is on top. Speaking of tabs, when you click to drag one the page turns blue with 5 icons in the center. What I’ve discovered is that if you drag the tab into one of the icons the page tries to fill the related section of the interface; top icon fills the top half of the document interface, left fills left half, etc, with center filling the entire document interface again. Notice I said “tries to fill”, it doesn’t currently work but the blue area shows what is intended.

- The Find tool looks to have been improved significantly. No longer is there a separate Replace tool, it has been combined into the default Find (Ctrl+F). It has also added an additional dropdown, “Look in”. Look in has the choices of “Full Source Code”, “Code and Strings”, “Comments Only”, and “Strings Only”.

- (Ctrl+I) still brings up the Find in Files, but this seems to have improved even more than the Find tool. First it also adds Replace so you can easily replace throughout several files. A results panel has also been added to the bottom of the tool so you can easily see all of the found files and easily open them without going to the Results panel at the bottom of FD.

- You no longer have to have a project open to get code completion. It seems to work just as well on an individual as file.

- A very cool feature that I stumbled upon and loved in PrimalScript is a built in browser! If you go to help and click on “FlashDevelop Home”, the FD forum will load up in a new tab right in the interface.

- Under help there is a new link added as well, “Online Documentation”. Looks like eventually we might have true documentation for FD :) The link (which hasn’t added any real documentation yet) is: http://www.flashdevelop.org/wikidocs/index.php/Main_Page.

- File New adds the ability to choose the type of file you want to create, including different files for as3 and as2. It looks like you will be able to customize the default template of each eventually as well, but not positive at this point.

- Nothing seems to have been added to the Project panel yet. Can’t wait for this one.

- Not seeing anything about svn or cvs integration.

- Quick MTASC Build is now called Quick Build. I’m assuming we’ll be able to use it for mtasc builds for as2 and ant builds for as3, but not positive just guessing.

- A new tool has been added, “Application Files”. Not exactly sure what it does yet, but it seems to default to opening up the FirstRun directory in an explorer window.

- Global Classpaths is removed from the Tools menu.

- All of the windows just seem so much nicer and more organized. A good example is the Program Settings window. It’s no longer just a long list, but nicely sectioned off with shorter more standard names. Still no settings for code coloring, but we can hope.

- The panel on the right has added a Layouts tab, which I’m not sure about yet and the ActionScript tab has been renamed Outline which makes more sense. Maybe it will support other languages as well.

And that about covers it for now. There will definitely be more to talk about once the Project Panel supports as3 and flex… which looking at the TODO doc seems to be one of the major things left to implement. All in all it seems to be really shaping up and I can’t wait until they release an actual alpha version to the public. Good job guys!

Posted in Flash | Leave a comment
Introduction to Flex 2 – Go and Get It !Roger Braunstein just completed the O'Reilly Short Cut Introduction to Flex 2.

Fellow Schematician Roger Braunstein recently completed the O’Reilly Short Cut “Introduction to Flex 2“. I got a chance to preview it before he was completely done and even at that time it was a great read full of tips to quickly get you up to speed on Flex 2 and AS3. Now that it’s released, I can safely say it’s a steal at under $10. What are you waiting for?… go get it!

Posted in Flex | Leave a comment
AS3 LuminicBox – ( Update )Couple of small updates to AS3 LuminicBox.

I didn’t have strict mode errors turned on in the Flash 9 preview, so I didn’t realize that the last release was giving a status event error when connecting to FlashInspector. I’ve updated the code to fix the problem. I’ve also added default values to the methods that were optional in the as2 version to make them optional in the as3 version as well.

Download it here.

Posted in Flash | 3 Comments
LuminicBox.Log – AS3 UpdateI decided to update LuminicBox to AS3.

I use LuminicBox.Log all of the time for AS2 projects and as I’m transitioning more and more to AS3 projects, I realized I really missed it. I took some time today and updated the classes and even the FlashInspector to AS3 (hopefully Pablo Costantini doesn’t mind). I needed to update FlashInspector so that it could interpret some of the new AS3 types: root, stage, DisplayObject, XMLList, SimpleButton, etc). The documentation has been updated with asdoc as well. The flash example files that are included have been updated and only work from the Flash 9 Preview. Let me know if there’s anything I missed or if you notice any bugs.

Updated AS3 version.

Original AS2 version.

Posted in Flash | 8 Comments
charsets (for use with swfmill)Here's some charsets in an easy-to-copy format for use with swfmill.

I’m embedding fonts using swfmill in a project I’m currently working on and one of the more tedious tasks I went through was copying and pasting the individual characters I needed to make up the character sets to be used. Because of this, I thought it might be helpful to others to post the charsets in a way that would be easy to copy and paste. I will try to keep this page up to date and add more sets as I get the time.

Note: The sets are accurate to the best of my knowledge, but please use at your own risk.

ISO/IEC 8859-1:1998 Latin Alphabet No. 1

 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ

ISO/IEC 8859-2:1999 Latin Alphabet No. 2

 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ Ą˘Ł¤ĽŚ§¨ŠŞŤŹ­Ž­Ż°ą˛ł´ľśˇ¸šşťź˝žżŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢßŕáâăäĺćçčéęëěíîďđńňóôőö÷řůúűüýţ˙
Posted in Flash | 3 Comments
Minor updates to “Trace from the browser…” tutorialAdded Linux info and a few other small tweaks to keep the tutorial up-to-date.

Made a few minor updates to my “Trace from the browser, using standard trace()” tutorial.

Posted in Flash | Leave a comment
Metaliq Components and MTASCHow to tweak the classes provided with the latest version of the Metaliq component set to be compliant with mtasc.

In my last post I briefly mentioned that I would discuss how to tweak the classes that are shipped with the latest version of the Metaliq component set to be compliant with mtasc. The steps that I will take assume that you have purchased a license of the Metaliq component set and have the latest version with the source code. It also assumes you already have mtasc and swfmill setup. If you don’t know what these tools are, or how to set them up, you can go to their respective homepage or find numerous tutorials to help you get up to speed. I actually use FlashDevelop which comes pre setup with both of these tools. The following steps will create a project in FlashDevelop and allow you to start compiling the Metaliq components with mtasc. You should be able to easily translate this to Eclipse or other script editor of choice.

  1. Create a new Library Project and name it “Metaliq”. Make sure to check “Create directory for project”.
  2. In the Project Explorer, open up the properties panel for the project. Under “Test Movie”, change the pulldown option to “New Window”.
  3. Go to the Build tab and delete the Post-Build Command Line text and hit Apply.
  4. Go to the Compiler Options tab and click on IncludePackages. A button with a “…” will appear, click on that. Delete the text in that window and hit OK.
  5. Set UseMain to true.
  6. Set TraceMode to FlashOut. Hit OK and close out of the properties panel.
  7. Find where your Metaliq source code is and copy the “com” folder over to the “classes” directory of your new project. Make sure to copy it and not move it since we will be editing the source.
  8. From the Metaliq source, go to the “flas” directory and copy Button.fla to the “library” directory of your new project.
  9. Open Button.fla in Flash (there should be nothing on the stage). Go to the publish settings and add the following class path: “../classes/” (without the quotes). Save, compile and close.
  10. In the “classes” directory of your project, create a new class named “ButtonTest.as” and add the following code:

    			import com.metaliq.controls.Button;
    			import com.metaliq.skins.FocusRect;
    			import com.metaliq.skins.gskin1.ButtonBackground;
    
    			class ButtonTest {
    				// content holder
    				var content:MovieClip;
    
    				function ButtonTest() {
    					// create dummy variables to pull in required classes for mtasc
    					var fr:FocusRect;
    					delete fr;
    					var bb:ButtonBackground;
    					delete bb;
    
    					content = ButtonTest.parent.createEmptyMovieClip("content", 0);
    
    					var sample_btn:Button = content.createClassObject(Button, "sample_btn", content.getNextHighestDepth(), {
    						icon:"icon1",
    						label:"Hello world!",
    						labelPlacement:"right",
    						selected:false,
    						toggle:true,
    						enabled:true,
    						visible:true,
    						minWidth:15,
    						minHeight:15,
    						_x:10,
    						_y:10,
    						_width:150
    					});
    
    					configButton();
    				}
    
    				private function configButton():Void {
    					content.sample_btn.addEventListener("click", onButtonClick);
    				}
    
    				private function onButtonClick(evtObj:Object):Void {
    					if (evtObj.target._name == "sample_btn") {
    						trace("you clicked the button");
    					}
    				}
    
    				// APPLICATION INITIALIZATION
    
    				static var application:ButtonTest;
    				static var parent:MovieClip
    
    				/**
    				* Application entry point
    				*/
    				static function main(scope:MovieClip) {
    					parent = scope;
    
    					// create the content
    					application = new ButtonTest();
    				}
    			}
    			

    If you look at the class above, you will notice a main method that gets called by mtasc. This main method creates an instance of the ButtonTest class which in turn begins the setup for instantiating a Metaliq component through code. We are using the createClassObject method to instantiate the Button component. The parameters passed are className, instanceName, depth, and an initObject which sets the defaults for the component. Besides the Button class, two other classes are imported in for mtasc. Once you get through with the following steps, remove those imports and the instantiations of those classes to see the error that mtasc throws. It will clearly ask you to force compilation of those classes. The easiest way to do that is by adding in the import statement for each class and then creating a reference to the class by instantiating it. I immediately delete the instance so it doesn’t take up memory.

  11. In FlashDevelop’s Project Explorer, right-click on ButtonTest.as and select “Always Compile”. And right-click on Button.swf and select “Add to Library”.

These previous steps are the basis for setting up a project in FlashDevelop to compile with mtasc and swfmill. The next steps will be getting the Metaliq classes to compile with mtasc.

  1. Hit F5 (Test Movie). You should see an error pop up. Double click on the error to bring up the class that is causing the error.
  2. The error is “unknown variable” in FocusRect.as. If you look in the constructor, there is an onEnterFrame function. Within this function, a call to the draw method is made. The simplest way to fix this is to add “this.” in front of “draw()” to scope the method properly.
  3. Hit F5 again and then do the same for the next error.
  4. The next error is “return type cannot be Void”. If you double click on this error, it will open up UIObject to around line 90 within the glicInit method. If you notice, the return type for glicInit is Boolean but the first line returns nothing. mtasc doesn’t like this. To fix it, change if (initted) to if (!initted) , delete the return and put the rest of the method within the brackets.
  5. Your next error will go back to “unknown variable”. You know how to fix these.
  6. Another error you will get is “Object should be MovieClip”. This is an easy one to fix. Wrap the object that is causing the error in MovieClip() to typecast it.
  7. The next error is “Object should be String”. Just add String() around the offending objects.
  8. The next error is “unknown variable m”. If you look above the error, you will see that m gets declared within an if statement. To fix the error, declare the m above the if statement and set m in the if statement.
  9. The next time you hit F5, mtasc should finally compile nicely. The button probably will just be text at this point (text acting as a button with no background). To see the background behind the button, you have to do something very random. I have gone through and converted all of the classes to be mtasc-friendly and this was the only part that still doesn’t make complete sense to me, but it works. In BaseButton.as, add the following code to around line 88:

    			public function set background(p_bg:String):Void { super.background = p_bg; };
    			

    For some reason, even though BaseButton extends UIObject, without the above statement the call to set background does not automatically go up the chain to UIObject without explicitly forcing it to. If you compile now, you should see the background behind the button. You now have a fully working example of a Metaliq component being compiled with mtasc.

  10. Continue along with these steps and slowly and surely you will start to make headway through the rest of the classes. Be forewarned there are a lot of errors to fix to make the entire component set mtasc compliant. But once you do, your life will be much simpler and your compiling will be MUCH faster.

Enjoy and feel free to comment with questions below.

Posted in AIR, Flash | 4 Comments
Metaliq Components (finally getting the love they need)Metaliq has decided to finally start supporting the Metaliq components and provide the source.

When the Metaliq components were first released, I quickly encouraged my company at the time to fork over the $400 so that we could FINALLY have some solid, light-weight Flash components. While, yes, they were light-weight and even pretty solid, I was extremely disappointed to find out that the source code was not included. What quickly became even more frustrating was that Metaliq, at the time, was not actively supporting the components. The documentation was sparse and, more importantly, Metaliq was not responding to any support questions or comments that quickly came up around the Flash community. Oh well… the purchase was already made and we needed to use the components so I made the best of it.

Close to a year later, I suddenly got an email in my inbox from someone at Metaliq. I quickly looked it over and found out that they were updating the documentation and asked if I wanted to review it. Nice…, a year late, but none-the-less nice. What’s more, I could send questions and comments and he was responding… wow actual customer service… unbelievable.

This at least renewed my interest in the Metaliq components. So, when I got to my new company and we needed to work on a Flash 8 project (how it hurts to move backwards), I again encouraged the purchase of the set since the project called for several existing components and there’s no need to use the bloated v2 set. And if nothing else, at least they’re simple to skin. Once the purchase was approved and the components were delivered, I quickly opened them up and noticed something different… a folder labeled source. Could it be? Yes, It was! The latest release of the components comes with all of the classes and all of the flash source files! How nice!

Once I started looking through the source, I wondered something…. could we now compile the mCOM set with MTASC? I quickly set a project up in my editor of choice, FlashDevelop, hit compile and, unfortunately, MTASC complained. I looked at the error, decided to make a fix to the source, and tried again… another error. Damn. Oh well.

A couple of days later, I was talking with my friend Mark Llobrera and lo and behold, he was having the same problem. We quickly started tearing through the code, passing tips back and forth over IM, and within a few minutes had Button compiling with MTASC. Once we realized the MTASC-related problems in the code, they were simple to fix.

This post will not go into the details of how to fix the code, I’ll cover that in my next post. I just wanted to let people know if they already own the component set, and have not done so yet, to request the latest from Metaliq. And, if you’ve been scared off in the past on purchasing the components and still have a lot of pre-Flash 9 work to do, I suggest giving them another try.

Posted in Flash | 7 Comments
  • Pages

  • Categories

  • Archives