Franto

About this author:

Contact:

My Articles:

March 17th, 2009

DragManager.doDrag problems

DragManager.doDrag problems

I have found 2 issues with DragManager.doDrag. One of the problem is just on Mac and second one is “not really problem”, but strange behavior between web version and AIR version. I really can’t find answers for this problems, so I’m trying to get answers from you. I hope anyone has workaround for me :)

So, first problem is about dragImage alpha problem on Mac. Imagine this: I want drag some button and I want to make dragImage (which is “screenshot” of that dragged button) transparent. So i have create Bitmap from that button and use it as 4th parameter of doDrag() function.

DragManager.doDrag(this, dragSource, event, dragImage, draggedButton.x, draggedButton.y, 0.5, false);

Problem is that on PC dragImage is transparent, but on Mac is solid. And problem is just in AIR, not in web version (Flex). You can try it here

Try drag any button and you should experience this: web version works for PC and Mac as well (I don’t have Linux, so you can try Linux as well), but AIR version works just for PC. DragImage on Mac will be solid and not transparent.

Does anyone know, if this is bug, or there is some workaround for this?

Second issue I have found is somethin strange. As I’m listening from dragStart on Canvas and it handles all 3 buttons, I need to set offset to doDrag() function (5th, 6th parameter) from dragged buton. And you know what? There is difference between web version (Flex) and desktop version (AIR). In web version I need to insert offset like -draggedButton.x, -draggedButton.y, but in AIR version I need to insert draggedButton.x, draggedButton.y. Really strange, but otherwise it doesnt work as expected.

You can see sources of both projects. For web version, use right click, there is View Source and for AIR version use this link for downloading project source: AIR Project Download.

I would be glad to hear your opinions and solutions or workarounds. Thank you

Source for creating screenshot and calling DragManager.doDrag

private function dragStart(event:DragEvent):void
{
	var dragSource:DragSource = new DragSource();
 
	var dragImage:Image = new Image();
	var bd:BitmapData = new BitmapData(draggedButton.width, draggedButton.height, true, 0x00000000);
	bd.draw(draggedButton);
        dragImage.source = new Bitmap(bd);
 
	var shadow:DropShadowFilter = new DropShadowFilter(5,225,0x000000,0.5);
	var glow:GlowFilter = new GlowFilter(0x888888,0.5,20,20);
	glow.inner = true;
	dragImage.filters = [shadow, glow];
 
	dragImage.alpha = 0.5;
 
        DragManager.doDrag(this, dragSource, event, dragImage,
                       draggedButton.x, draggedButton.y, 1, false);
}
read more
February 9th, 2009

Flex Styling & Skinning Presentation for Slovak FUG

Flex Styling & Skinning Presentation for Slovak FUG

Today I will have presentation about Flex Styling & Skinning for slovak Flex User Group called Flexgarden. If there are really cool skinned or styled Flex applications on web or AIR applications for desktop, or something other really cool I can show to slovak flex coders, please let me know. Presentation will be today at 7pm CET. Sure I’m aware of sites like scalenine.com, fillcolors.com and similar :)

Thank you

read more
February 6th, 2009

Fastest way of closing AIR application

Fastest way of closing AIR application

Today on FlexLib mailinglist I’ve found quite nice and interesting question:

Dear Folks,

In my appliaction, The code: “application.close();” is used to exit
the application.
And I found, no. of ways are there to exit the application. Let me
know, which one is best , should allow the
grace full exit and should faster.

No. of ways to Exit in Flex:

1. NativeApplication.nativeApplication.exit();
2. Application.application.exit();
3. application.close();
4. exit();

And please advise, any other option is there to exit the application.

Thanks in Advance

Lokh

What are your experiences with closing AIR application. Do you think it’s matters on function which is closing AIR application?

Post your thoughts and I will post them to the FlexLib mailinglist.

Thank you

read more
February 5th, 2009

Basecamp has 5 years anniversary

Basecamp has 5 years anniversary

In Flexets we are using Basecamp for project management. It’s really great tool and yesterday Basecamp had 5 years anniversary. Here are few impressive numbers :)

Today over 3,000,000 people have Basecamp accounts. Over 2,800,000 projects have been created. Over 26 terabytes of files have been uploaded. Over 20,000,000 messages have been posted, over 31,000,000 to-dos have been added, and over 5,000,000 milestones have been completed. All in five short years over the web from around the world.

Read more at 37 signals.

read more
February 4th, 2009

AS3 Conditional Breakpoint – enterDebugger()

AS3 Conditional Breakpoint – enterDebugger()

I have to confess I didn’t know about great function enterDebugger() in flash.debugger package. If you ever want to have conditional breakpoint you can do it programatically. Just add this statement to your code and debuger will stop as it there would be normal breakpoint. So you can use it in IF statement and call it just when some conditions are met. I think I will use this function a lot from now on :)

Enjoy

read more
February 4th, 2009

Win Adobe CS4 Web Premium and Flex Builder Pro 3

Win Adobe CS4 Web Premium and Flex Builder Pro 3

You have time just till tommorow so act fast (I’ve found out this just today from Sitepoint.com newsletter). There is easy way how to include you into draw. Just read this article on Sitepoint.com: Ajaxify Your Flex Application and take this quiz. There are 5 easy questions and if you are Flex coder you should probably know asnwers without reading article, but it’s always better to read it and maybe learn something new. If you will answer 5 times correct you can win your own copy of Adobe CS4 Web Premium and Flex Builder Pro 3.

Wish you best luck :)

read more
February 1st, 2009

Crop whitespace from PNG image

Crop whitespace from PNG image

Yesterday, I’ve posted about interesting AS3 Class InteractivePNG, and now I’m adding new addition for solving other problem with transparent Bitmaps. If you have transparent bitmap with whitespace around image and you want to crop whitespace around “real” image, you can use this function…

public static function getBitmapCroppedOutWhitespace(bd:BitmapData):Bitmap
{
	var bmd:BitmapData = new BitmapData(bd.width, bd.height, true, 0x00000000);
	bmd.draw(bd);
 
	var rect:Rectangle = bmd.getColorBoundsRect(0xFFFFFF, 0x00000000, false);
	var bmd2:BitmapData = new BitmapData(rect.width, rect.height, true, 0x00000000);
	bmd2.draw(bmd, new Matrix(1,0,0,1, -rect.x, -rect.y));
 
	var bmp:Bitmap = new Bitmap(bmd2);
 
	return bmp;
}

From BitmapData it creates Bitmap without whitespace. It will find whitespace automaticaly and removes it. If you want to insert Bitmap data instead of BitmapData, just edit this function slightly. This is just idea how to do such cropping. Enjoy, I hope it will be useful for someone.

read more
January 31st, 2009

InteractivePNG – useful AS3 class

InteractivePNG – useful AS3 class

I’m working on some game editors for my old game engine (not finished) to show people something what I have done and let people convince me maybe to continue (fallenswordsgame.com). There are lot of PNG assets used. If there are many PNG images on stage, there is problem with selection of correct one, because in AS3 there are MouseEvent events even on transparent pixels and that’s problem. I have tried search if someone did great job on some workaround and I have found really great AS3 class called InteractivePNG. You can set even alphaTolerance to tell class if your MouseEvent event should be catched on semitransparent pixels or just opaque pixels. Check it out InteractivePNG demo. It really helps me, so I hope it can help you as well. Great job, Moses.

read more
January 28th, 2009

FireScope – HTML and CSS Reference for Firebug

FireScope – HTML and CSS Reference for Firebug

SitePoint.com has released FireScope, which is HTML and CSS Reference fo Firebug, so now Firebug is even more powerful with inline help. You can see which browser support currently viewed feature, in which browser is feature implementation buggy and so on… I like FireBug much and even now with quick help it is really Firefox extension which everyone who wants to understand HTML and CSS, quick edit page, or just find some problem on page should have installed.

This is tool which helps me to help my customers at Become The Webmaster Coaching.

read more
December 22nd, 2008

Wallpaper for you – Christmas Wallpapers

Wallpaper for you – Christmas Wallpapers

As Christmas is really near, I’ve created few Christmas Wallpapers for you. You can use them as desktop wallpapers, or send them as Merry Christmas and Happy New Year wishes and cards. If you want to use them in your websites or anywhere else, please give me proper credits and link back to franto.com.

Christmas Wallpapers from Franto.com

And here you can see list of all my wallpapers for you. Just click on image bellow :)


read more
Images is enhanced with WordPress Lightbox JS by Zeo