React

React
Fundamental of React Js

Tuesday, December 25, 2007

Dynamic Rotate

Load Image from Xml and Make Rotate

Screen View:

Code View

output View
Here the Code:

Here the code:

import mx.transitions.Tween;

var xml:XML=new XML()

xml.ignoreWhite=true

xml.onLoad=function(s){

if(s){

_root.bg.createEmptyMovieClip('image',1)

_root.bg.image.createEmptyMovieClip('rose',2)

var mcLoader:MovieClipLoader=new MovieClipLoader()

var listener:Object=new Object()

listener.onLoadInit=function(target:MovieClip){

target._width=150

target._height=150

target._x=-75

target._y=-75

target._parent._x=150

target._parent._y=150

}

mcLoader.addListener(listener)

mcLoader.loadClip(xml.firstChild.firstChild.firstChild.firstChild.toString(),_root.bg.image.rose)

}

}

xml.load('load.xml')

clicker_fw.onPress=function(){

var twe=new Tween(_root.bg.image,'_rotation',null,0,360,10,true)

_root.bg.image._rotation=90

}

clicker_rw.onPress=function(){

var twe=new Tween(_root.bg.image,'_rotation',null,360,0,10,true)

_root.bg.image._rotation=90

}




0 comments: