Flex Dynamic loading SWF Skin sample code _flex

Source: Internet
Author: User
Copy Code code as follows:

<?xml version= "1.0" encoding= "Utf-8"?>
<s:application xmlns:fx= "http://ns.adobe.com/mxml/2009"
Xmlns:s= "Library://ns.adobe.com/flex/spark"
xmlns:mx= "Library://ns.adobe.com/flex/mx" minwidth= "955" minheight= "600"
Creationcomplete= "Inithandler (event)" >
<fx:Script>
<! [cdata[
Import Flash.utils.clearTimeout;
Import Flash.utils.setTimeout;

Import mx.events.FlexEvent;
private Var styleurl:string= "";

private Var Settimeout2:uint;
protected function Inithandler (event:flexevent): void
{
Styleurl= "style01.swf";
Stylemanager.loadstyledeclarations (styleurl,true);
}

protected function T1_clickhandler (event:mouseevent): void
{
if (styleurl!=null)
{
Stylemanager.unloadstyledeclarations (styleurl,true);
}
Stylemanager.loadstyledeclarations ("style02.swf", true);
Styleurl= "style02.swf";
}

protected function Button1_clickhandler (event:mouseevent): void
{
SetTimeout2 = settimeout (button1_click,2000);
}

Private Function button1_click (): void
{
if (styleurl!=null)
{
Stylemanager.unloadstyledeclarations (styleurl,true);
}
Stylemanager.loadstyledeclarations ("style03.swf", true);
Styleurl= "style03.swf";
Cleartimeout (SETTIMEOUT2);

}

protected function Button2_clickhandler (event:mouseevent): void
{
TODO auto-generated Method Stub
if (styleurl!=null)
{
Stylemanager.unloadstyledeclarations (styleurl,true);
}
Stylemanager.loadstyledeclarations ("style01.swf", true);
Styleurl= "style01.swf";
}

]]>
</fx:Script>
<fx:Declarations>
<!--place non-visual elements (such as services, value objects) here-->
</fx:Declarations>
<s:panel horizontalcenter= "0" y= "width=" 422 "height=" "title=" User Login >
<s:layout>
<s:verticallayout horizontalalign= "center" verticalalign= "middle" gap= ""/>
</s:layout>
<s:hgroup verticalalign= "Middle" >
<s:label text= "User name"/>
<s:textinput id= "T1" stylename= "TextInput" prompt= "Please enter user name"/>
</s:HGroup>
<s:hgroup verticalalign= "Middle" paddingleft= ">"
<s:label text= "password" id= "T2"/>
<s:textinput stylename= "TextInput" prompt= "Please enter password"/>
</s:HGroup>
<s:controlBarContent>
<s:button label= "Little Pink" click= "T1_clickhandler (event)" color= "0xff00ff"/>
<s:button label= "Classic Blue (2 seconds)" click= "Button1_clickhandler (event)" color= "0x4169e1"/>
<s:button label= "Green Grass (default)" Click= "Button2_clickhandler (event)" color= "0x00ff00"/>
</s:controlBarContent>
<s:controlBarLayout>
<s:horizontallayout gap= "The/>"
</s:controlBarLayout>
</s:Panel>
</s:Application>

Copy Code code as follows:

/* CSS file */
@namespace S "Library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/mx";

Global
{
color: #dc143c;
fontFamily: "Microsoft Ya-hei";
BorderColor: #caff70;
Fontsize:20;
Borderweight:3;
}
s| Panel
{
BackgroundColor: "#00FF00";
backgroundalpha:0.3;
}
s| TextInput
{
Color: #ff0000;
fontFamily: "Microsoft Ya-hei";
BorderColor: #ffff00;
Fontsize:20;
}
s| Button
{
Paddingleft: "10";
Paddingtop: "5";
}
. textInput
{
Color: #cd8500;
fontFamily: "Microsoft Ya-hei";
BorderColor: #ff0000;
Fontsize:20;
}
#t1
{
Color: #00ff00;
fontFamily: "Microsoft Ya-hei";
BorderColor: #0000ff;
Fontsize:20;
}
#t2
{
Color: #0000ff;
fontFamily: "Microsoft Ya-hei";
BorderColor: #ff00ff;
Fontsize:20;
}

Copy Code code as follows:

/* CSS file */
@namespace S "Library://ns.adobe.com/flex/spark";
@namespace mx "LIBRARY://NS.ADOBE.COM/FLEX/MX";
Global
{
Color: #191970;
fontFamily: "Microsoft Ya Hei";
BorderColor: #caff70;
fontsize:20;
Borderweight:3;
}
s| Panel
{
BackgroundColor: "#E066FF";
}
s| TextInput
{
fontFamily: "Microsoft Ya Hei";
BorderColor: #ffff00;
fontsize:20;
}
. textInput
{
fontFamily: "Microsoft Ya Hei";
BorderColor: #ff0000;
fontsize:20;
}
#t1
{
Color: "#00FFFF";
fontFamily: "Microsoft Ya Hei";
BorderColor: #0000ff;
fontsize:20;
}

Copy Code code as follows:

/* CSS file */
@namespace S "Library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/mx";
Global
{
color: #388E8E;
fontFamily: "Microsoft Ya-hei";
BorderColor: #caff70;
Fontsize:20;
Borderweight:3;
}
s| Panel
{
BackgroundColor: "#00B2EE";
}
s| TextInput
{
fontFamily: "Microsoft Ya-hei";
BorderColor: #ffff00;
Fontsize:20;
}
. textInput
{
fontFamily: "Microsoft Ya-hei";
BorderColor: #ff0000;
Fontsize:20;
}
#t1
{
Color: "#6B8E23";
fontFamily: "Microsoft Ya-hei";
BorderColor: #0000ff;
Fontsize:20;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.