Archive for the “Flex” Category

For some odd reason you might want to get the width and height of the inside of a Container. You can use the "viewMetrics" property of a container to do it.

			/*-------------------------------------------------------------------
			   Returns a Rectangle object of the inside view area of a Container,
			   instead of the complete width and height.
			 ---------------------------------------------------------------------*/
			private function getViewRectangle(ui:Container):Rectangle
			{
				var e:EdgeMetrics=ui.viewMetrics;
				var r:Rectangle=new Rectangle();
				r.width=ui.width - (e.left + e.right);
				r.height=ui.height - (e.top + e.bottom);
				r.x=e.left;
				r.y=e.top;
				return r;
			}

In the following example I overlay a green box over a Panel to show how it matches the Panel's size.
Comments are welcome.
Read the rest of this entry »

Vote in HexoSearch

Comments No Comments »

I use Flex for the majority of my Flash related work, even for writing plain ActionScript. Lately I've barely even used the Flash authoring environment to create stuff. When I do use the Flash authoring environment, it's mostly for automation and prep work of content. If you are like me, you write JSFL to do that stuff.

I love automating redundant tasks. One thing that bugs me when importing graphical assets to Flash's stage is having to resize the document to what I imported. I like that I can do this by going to the Document Properties and setting the document to match the content size, but if I have to do this each time I import/export content it becomes a irksome chore. I write JSFL scripts that run tasks on multiple files, having a "match contents" function would be useful to me in my case...maybe to you as well. I do not see a JSFL way to do this. (Maybe there is and I had a brain fart?). Until then, here is a script I wrote to do it in JSFL...
Read the rest of this entry »

Vote in HexoSearch

Comments 1 Comment »

When I am writing a flash app or game which uses the keyboard to control a character's movement, there is a situation that becomes annoying while controlling the character. I do not know the proper term for it ("sticky keys"?) but I will describe it...keyboard

When an app or game is written we "expect" the user to precisely press the proper key or key combination at a time to execute programmatic actions. However, most of us have ten fingers and we use more than one finger to press more than one button on the keyboard. The expected program reaction from multiple fingered keyboard input might not occur because you have another function executing when you expect just one at a time.
Read the rest of this entry »

Vote in HexoSearch

Comments 14 Comments »

Thanks for visiting www.keith-hair.net