protected function application1_creationCompleteHandler(event:FlexEvent):void
{
loader = new Loader();
loader.contentLoaderInfo.addEventListener( Event.COMPLETE, loaderComplete );
loader.load( new URLRequest( "cards.png" ) );
}
/**
* Extract each card in the deck into their own object
* The object includes a label (rank of suit) and a Bitmap image of the card
*/
protected function loaderComplete( event:Event ):void
{
var suitsIdx:Number = 0;
var ranksIdx:Number = 0;
var cardWidth:Number = 79;
var cardHeight:Number = 123;
var a:Array = [];
var img:BitmapData;
var d:BitmapData = Bitmap( loader.content ).bitmapData;
for ( var i:int = 0; i < 52; i++ )
{
img = new BitmapData( cardWidth, cardHeight );
img.copyPixels( d, new Rectangle( ranksIdx * cardWidth, suitsIdx *
cardHeight, cardWidth, cardHeight ), new Point( 0, 0 ) );
img.draw( img, new Matrix() );
a.push( new Bitmap( img ) );
if ( i == 12 || i == 25 || i == 38 )
{
suitsIdx++;
ranksIdx = 0;
}
else
{
ranksIdx++;
}
}
list.dataProvider = new ArrayCollection(a);
list.selectedIndex = 25;
}
Wednesday, November 11, 2009
Creating in Memory BitMaps from a single image file.
I found this today while looking up information on the new Flex 4 Layout classes. This guy has a single .png file with a bunch of cards on it that he wants to use as individual images in his application. I was pretty impressed with the code, mainly because I had never really thought about it and it's an easy solution.
Friday, November 6, 2009
Getting Behind!
Wow I've really fallen off of keeping updates on here. It's been really busy here at 3-GIS over the past six or so months. We're doing a ton of extensions for our base product and continuing to push our Flex applications to do more than nature intended.
One of the cool things we've done in recent months is release a product called Mapper in a joint venture with another company. You can check it out here tucuxisoftware.com just don't ask me to explain the company name.
I think I dropped off the blog updates when I switched over my main development machine to a Mac. I got busy at that point figuring out everything about it and lost track of doing updates.
In the Adobe world this month's user group meeting we talked about Photoshop to Catalyst to Flash Builder. You can find the post about it here. You may have to be a member to see it, let me know if anyone has any issues.
The other hot topic right now is Google Wave! I've been playing around with it for the last couple of weeks. I'm still not sure what the total value of it is going to be. If anyone is reading this and would like an invite just let me know. I have 10 invites open to the first 10 people to comment here!
One of the cool things we've done in recent months is release a product called Mapper in a joint venture with another company. You can check it out here tucuxisoftware.com just don't ask me to explain the company name.
I think I dropped off the blog updates when I switched over my main development machine to a Mac. I got busy at that point figuring out everything about it and lost track of doing updates.
In the Adobe world this month's user group meeting we talked about Photoshop to Catalyst to Flash Builder. You can find the post about it here. You may have to be a member to see it, let me know if anyone has any issues.
The other hot topic right now is Google Wave! I've been playing around with it for the last couple of weeks. I'm still not sure what the total value of it is going to be. If anyone is reading this and would like an invite just let me know. I have 10 invites open to the first 10 people to comment here!
Monday, March 16, 2009
FlashVars
I'm currently overseeing a project where our main application is being embedded into another web application. As part of this we needed to be able to pass information from an external source into our app, so we turned to Flash Vars. I'm not going to lie, it was a pain in the butt to figure out how to get them to work. I looked at a number of different examples, all of which failed, before I finally found one that steered me in the right direction, and even it had me doing edits in two or three places that were not necessary. In the end it was pretty simple (of course). Just open up your index.template.html for your application. You are going to edit the AC_FL_RunContent, but be careful because it's in two places, one for if the client didn't have the right flash player and one (the second one) for if they did. You need to edit this second one. Mine ended up looking something like this:
AC_FL_RunContent(Then to access the Flash Vars from Flex:
"src", "${swf}",
"width", "${width}",
"height", "${height}",
"align", "middle",
"id", "${application}",
"quality", "high",
"bgcolor", "${bgcolor}",
"name", "${application}",
"allowScriptAccess","sameDomain",
"type", "application/x-shockwave-flash",
"pluginspage", "http://www.adobe.com/go/getflashplayer",
"FlashVars", "MyToken="+token+"&a="+aVariable+"&b="+bVariable+""
);
var paramObj:Object = Application.application.parameters;And that was it. I of course check to make sure none of them are null etc. so that the application can still work stand alone. All in all it was a ton of ferreting around for the information and easy to do once I found this. Hope it helps someone else out.
var mapperToken:String = paramObj.MyToken;
var outsideA:String = paramObj.a;
var outsideB:String = paramObj.b;
Wednesday, January 28, 2009
Flex 3 for Education
Sorry no updates for a while on here. Listening to the Tech Wednesday for the Flex SDK today though they said a couple of things that I thought were worth posting on.
- Flex 4 will be delivered in Q4 of 2009 with open beta in the second quarter.
- Adobe gives Flex Builder 3 Profesional away to students, faculty, and any employees!
Subscribe to:
Posts (Atom)