Skin the WindowedApplication

The following example shows you how to extends the ProgrammaticSkin and add an image as background of your WindowedApplication positioned at the center of the window;
usage :
WindowedApplication {

borderSkin: ClassReference("com.gnstudio.skins.ApplicationSkin");

}
package com.gnstudio.skins
{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.events.Event;
import flash.geom.Matrix;
import flash.geom.Point;
import flash.geom.Rectangle;

import mx.controls.Image;
import mx.skins.ProgrammaticSkin;

public class ApplicationSkin extends ProgrammaticSkin{

[Embed(source="skin/application/bckg.jpg")]
private var imageClass:Class

private var _image:Bitmap;
private var _bitmapData:BitmapData;

override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{

super.updateDisplayList(unscaledWidth, unscaledHeight);

var backgroundColor:uint = getStyle("backgroundColor");

if(!_image){

_image = new imageClass()
_bitmapData = new BitmapData(_image.width, _image.height);
var matrix:Matrix = new Matrix();
_bitmapData.draw(_image,matrix);

}


if(unscaledWidth && unscaledWidth){

graphics.clear();
graphics.beginFill(backgroundColor);
graphics.drawRect(0, 0, unscaledWidth,unscaledHeight);
graphics.endFill();

var x:Number = unscaledWidth/2 - _bitmapData.width/2;
var y:Number = unscaledHeight/2 - _bitmapData.height/2;
var bd:BitmapData = new BitmapData(unscaledWidth,unscaledHeight,true,backgroundColor);
bd.copyPixels(_bitmapData,new Rectangle(0,0,_bitmapData.width,_bitmapData.height),new Point(x,y));
graphics.beginBitmapFill(bd, new Matrix(), false, true);
graphics.drawRect(x, y, _bitmapData.width, _bitmapData.height);

}

}

}
}

Comments on this post

tJFWS4 <a href="http://vrqhlvhpjnak.com/">vrqhlvhpjnak</a>, bnwespbmqbsc, [link=http://uhexdgnhinfg.com/]uhexdgnhinfg[/link], http://zjmpnzeszwyp.com/
Tocuhdown! That's a really cool way of putting it!
Great heammr of Thor, that is powerfully helpful!
HuUwli <a href="http://xqbcejszfdos.com/">xqbcejszfdos</a>
Very true! Makes a canghe to see someone spell it out like that. :)
In recent years Louis Vuitton Handbagsthis inland port city of nearly 300,000Louis Vuitton Handbags people has earned several distinctions, none Chanel Handbagsof them good. Twice atop Forbes'Coach Factory Outlet list of America's Most Miserable Louis Vuitton PursesCities ... Second highest violent-crimeChanel Handbag rate in California ... Second highest home-foreclosure rate Boss Beltsof all major U.S. metro areas. Now, Stockton is on the Coach Factory Onlineverge of another dubious benchmark: bankruptcy.Louis Vuitton Purses In its third straight year of fiscal emergency,Coach Factory Online the city faces a deficit of as high asCoach Factory Outlet $38 million on its $165 million general fundCoach Factory Stores budget. As required by state law,Coach Outlet Store the city
Eric, the water droplets efecft on lab.andre-michelle.com that Alex mentioned is done in a similar fashion with the caustic efecft.All efecfts like this use a displacement map. I load the map from a sequence since I couldn't program the pattern. Andre most likely draws the rings with flash drawing API and renders the movie clip into a bitmap and then applies the transformation.My suggestion to you is to learn the drawing API, how to use bitmaps and bitmaps affects. When you understand that, you'll know how to do all kind of efecfts.
Z7Fux2 <a href="http://lakbwxhcykcu.com/">lakbwxhcykcu</a>
great! Managing your buttons from mxml is really easy – you just need to setup dispatching events on the buttons and event metadata in NewFormPanel.as.First – add the event metadata above the Class declaration (adding the metadata will make the event available in your mxml classes where you instantiate the NewFormPanel class:[Event(name="buttonClicked", type="flash.events.Event")]public class NewFormPanel extends Panel{.......}Then add the new event, rather than the Alert, in the button click event handler method “doCreateForm()” and dispatch it:private function doCreateForm(event:Event):void{//create an event - just an Alert for testing here//mx.controls.Alert.show("Button Clicked");event = new Event("buttonClicked");dispatchEvent(event);}Here, we created a new “buttonClicked” event and dispatched it when the button was clicked.Now we need to listen for that event in the parent class, in this case “Main.mxml” where we instantiate NewFormPanel. The event will be available to us in the ButtonPanel properties/events (you can also set the event bubbling to true in the .as class if you need to listen for it elsewhere – e.g. this.addEventListener(“buttonClicked” doSomething):<components1:ButtonPanel buttonClicked="doSomething()" />Your “doSomething()” method then handles whatever it is you need to do in your .as or mxml classes.

<a href="http://www.medservice4u.com/">viagra</a> <a href="http://www.comparemedsprices.net/">acyclovir 400 mg cheap</a>
That did it, thanks! One more question, though… How do I now access these buttons from the MXML? I have:ButtonPanel.as – extends Panel, has the Save and Cancel buttons created in createChildren(). File is in my Skins directory.PanelForm.mxml – Uses Skins:ButtonPanel, has some other functionality within it. This is where I want to be able to add event listeners to the Save and Cancel buttons, as their functions are specific to the content of this file.

<a href="http://www.purplepillonline.com/">nexium</a> <a href="http://www.hairmedspills.com/">generic propecia</a>

Post a comment

Embed any code between [code] [/code] tags
captcha image   Reload