Skip to main content

Flex Banner Example

Simple Flex Fade in Fade out Banner Example

CODE:
1:  <?xml version="1.0" encoding="utf-8"?>
2: <mx:Application verticalScrollPolicy="off" verticalGap="0" horizontalGap="0" horizontalScrollPolicy="off" xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" paddingTop="0" paddingLeft="0" paddingRight="0" paddingBottom="0" verticalAlign="middle" backgroundColor="white" creationComplete="{init();}">
3: <mx:Script>
4: <![CDATA[
5: import mx.effects.WipeLeft;
6: import mx.events.TweenEvent;
7: import mx.controls.Alert;
8: import mx.events.EffectEvent;
9: import mx.effects.Fade;
10: import mx.effects.Pause;
11: import mx.effects.Sequence;
12: import mx.effects.SetPropertyAction;
13: import mx.effects.WipeRight;
14: private var fader:Sequence;
15: private var wiper:Sequence;
16: public var wipeIn:WipeRight;
17: public var wipeOut:WipeLeft;
18: public var pause:Pause;
19: public var alphaOn:SetPropertyAction;
20: public var alphaOff:SetPropertyAction;
21: private var counter:int=1;
22: [Bindable]
23: private var imagesArr:Array =
24: [
25: "image1.jpg",
26: "image3.jpg",
27: "image4.jpg"
28: ];
29: public function init():void{
30: // for preloading image
31: var img:Image = new Image();
32: for(var i:int=0;i<imagesArr.length;i++){
33: img.source = "images/"+imagesArr[i];
34: }
35: start_wipe();
36: }
37: private function start_wipe():void {
38: wipeIn = new WipeRight();
39: wipeIn.showTarget = true;
40: wipeIn.duration = 3000;
41: wipeOut = new WipeLeft();
42: wipeOut.showTarget = false;
43: wipeOut.duration = 2000;
44: pause = new Pause();
45: pause.duration = 5000;
46: alphaOn = new SetPropertyAction();
47: alphaOn.name = "alpha";
48: alphaOn.value = 1.0;
49: alphaOff= new SetPropertyAction();
50: alphaOff.name = "alpha";
51: alphaOff.value = 0.0;
52: wiper = new Sequence();
53: wiper.addChild(alphaOn);
54: wiper.addChild(wipeIn);
55: wiper.addChild(pause);
56: wiper.addChild(wipeOut);
57: wiper.addChild(alphaOff);
58: wiper.stop();
59: wiper.play([imagePlaceHolder]);
60: wiper.addEventListener(EffectEvent.EFFECT_END,wiperEffectEnd);
61: }
62: public function wiperEffectEnd(evt:EffectEvent):void{
63: var len:int=imagesArr.length;
64: if(len==counter) counter=0;
65: img.source= "images/"+imagesArr[counter];
66: counter++;
67: this.start_wipe();
68: }
69: ]]>
70: </mx:Script>
71: <mx:HBox horizontalGap="0" verticalGap="0" id="imagePlaceHolder" width="100%" height="100%" verticalScrollPolicy="off" horizontalScrollPolicy="off" backgroundColor="#E6E6E6" alpha="0.0" paddingTop="0" paddingLeft="0" paddingRight="0" paddingBottom="0">
72: <mx:Image source="images/image1.jpg" id="img" />
73: </mx:HBox>
74: </mx:Application>

Comments

Popular posts from this blog

Flex Interview Questions

1) What is Flex? Flex is used to devleop Rich Internet Application (RIA) You can both desktop & web based applicaiton.It is markup language and object-oriented languages its many syntax match with flash action script. Flex Developers use typically five distinct phases to develoep Rich Internet Application. Design Configure Build Deploy Secure 2) How do i get Page URL and Query String ? We can use mx.core.Application.application.url (mx.core)package to work with current page URL. & query string. 3) Describe flex component file types ? There are following file types we can use in flex. extension .mxml - a component implemented as an MXML file. extension .as - a component implemented as an ActionScript class. extension .swc - a SWC file contains components in a packge. 4) Difference between target & currentTarget ? target : This property is set by the dispatchEvent() method. You cannot change this to a different object. currentTarget : This property is set by component instan...

Ethereum Programming Language

Solidity: The Programming Language of Ethereum Blockchain technology has revolutionized various industries by introducing decentralized and secure applications. Ethereum, one of the leading blockchain platforms, has gained immense popularity due to its ability to support smart contracts, which enable the execution of self-executing code with predefined rules. To write these smart contracts, developers use Solidity, a high-level, contract-oriented programming language specifically designed for Ethereum. In this article, we will explore Solidity in detail, including its features, syntax, use cases, advantages, and challenges. 1. Introduction to Solidity Solidity was introduced by Gavin Wood in 2014 and is the primary language for developing smart contracts on the Ethereum platform. It is a statically-typed language that supports inheritance, libraries, and complex user-defined types. Solidity code is compiled into bytecode, which can be executed on the Ethereum Virtual Machine (EVM), mak...

How to Format My Source Code For Blogger ?

How to format my source code for blogger, blog, Blogging, weblog & website ? Now you can format you source code for blogger, blog, Blogging, weblog & website using online source code formatter. This application build in javascript. This source code beautifier or formatter provide for your blogger, Blog and websites a good code indentation. You can can format your source code with alternative background using <pre> tag. It does not add unnecessary tags in formatted source code excpet <pre> and <code> so just try onto your source code for blog or blogging & website posts . This is absolutly free online line source code formatter tool for your blogger & website. http://codeformatter.blogspot.com/ See example.. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT=""> <META NAME="A...