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...

Convert excel to CSV file using PHP, Linx Server

How to convert xls file into csv file using php or LAMP, Look at simple example to convert excel to csv file using php on linux server. <?php require_once 'Excel/reader.php'; $excel = new Spreadsheet_Excel_Reader(); $excel->setOutputEncoding('CP1251'); $excel->read('b.xls'); $x=1; $sep = ","; ob_start(); while($x<=$excel->sheets[0]['numRows']) { $y=1; $row=""; while($y<=$excel->sheets[0]['numCols']) { $cell = isset($excel->sheets[0]['cells'][$x][$y]) ? $excel->sheets[0]['cells'][$x][$y] : ''; $row.=($row=="")?"\"".$cell."\"":"".$sep."\"".$cell."\""; $y++; } echo $row."\n"; $x++; } $fp = fopen("data.csv",'w'); fwrite($fp,ob_get_contents()); fclose($fp); ob_end_cl...

Set php.ini values into .htaccess file

How can i set php.ini configuration values into .htaccess file? Here is the simple solution to set php.ini variables into .htaccess file. Syntax non flag variables. php_value setting_name setting_value Example : php_value upload_max_filesize 10M Syntax for flag variables such as (on/off). php_flag [variable_name] [value] Exmaple : php_flag register_globals off