Author Archive

I like using MXML because it is quicker than writing ActionScript for a lot tasks.
When you create a TitleWindow in MXML, it is not draggable.
To make a TitleWindow draggable you have to create the window in ActionScript using the PopUpManager methods "createPopUp" or "addPopUp"
I wanted this process simpler so that next time I wanted a draggable window, I could just use a simple MXML tag.

Here I extended the TitleWindow to make it be automatically added with the PopUpManager.
Also all the child components get carried over after PopUpManager is used.
I did this so I could lazily use MXML and all references to this component instance stay intact, because the PopUpManager is using the same instance of the MXML component.

Get Adobe Flash player

The "Move Left" and "Move Right" buttons show that the references are ok.

Read the rest of this entry »

Vote in HexoSearch

Comments 3 Comments »

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 »

Thanks for visiting www.keith-hair.net