Playing youtube video using flash actionscript
Play youtube video using flash actionscript
Security.allowDomain("www.youtube.com");
var player:Object;
var loader:Loader = new Loader();
loader.load(new URLRequest("http://www.youtube.com/apiplayer?version=3"));
loader.contentLoaderInfo.addEventListener(Event.INIT, loader_fn);
function playerReady(e:Event):void{
player.setSize(450,360);
player.cueVideoById("AFR7hUpmJv4");
}
function loader_fn(e:Event):void{
addChild(loader);
player = loader.content;
player.addEventListener("onReady", playerReady);
}
This movie requires Flash Player 9
CS4 spring Motion using action script
var springX:Number=0;
var springY:Number=0;
var spring:Number=.95;
var radius:Number=300;
ball.addEventListener(Event.ENTER_FRAME, Event_ENTER_FRAME);
ball.x=ball.y=Math.random()*300;
stage.addEventListener(MouseEvent.MOUSE_DOWN, onClick);
function onClick(event:Event):void {
ball.x=mouseX;
ball.y=mouseY;
}
function Event_ENTER_FRAME(event:Event):void {
var ax:Number=0;
var ay:Number=0;
ball.x+= (springX += ((radius - (2 * ball.x)) * .1));
ball.y+= (springY += ((radius - (2 * ball.y)) * .1))
springX*=spring;
springY*=spring;
}
This movie requires Flash Player 9
flash cs4 text effects 0.3
Just playing with Text this is my second update for text effects
view previous post
This movie requires Flash Player 9
sample 0.3
glyph using action script
import flash.display.Sprite;
import flash.text.*;
function glyph(){
var strFontName:String = "Wingdings";
var givenFont:Font;
var enumeratedfonts:Array = Font.enumerateFonts(true);
for (var i:int = 0; i < enumeratedfonts.length; i++) {
if (enumeratedfonts[i].fontName == strFontName) {
givenFont = enumeratedfonts[i];
break;
}
}
trace(givenFont.hasGlyphs("www.flashallys.com/blog"));
}
glyph();
Add Background Image for AIR Application
background image for AIR application
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication name="WindowedApplication_backgroundImage_test"
xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle">
<mx:Style>
WindowedApplication {
backgroundColor: white;
backgroundImage: ClassReference("mx.skins.halo.ApplicationBackground");
}
</mx:Style>
</mx:WindowedApplication>
Flex doubleClickEvent
<?xml version="1.0" encoding="utf-8"?>
<mx:Application name="Image_doubleClick_test"
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
private function img_doubleClick(evt:MouseEvent):void {
Alert.show('double click event');
}
private function img_singleClick(evt:MouseEvent):void {
Alert.show('single click event');
}
]]>
</mx:Script>
<mx:Image id="img1"
source="colorpicker.JPG"
doubleClickEnabled="true"
doubleClick="img_doubleClick(event);" />
<mx:Image id="img2"
source="colorpickerwheel.JPG"
click="img_singleClick(event)" />
</mx:Application>
This movie requires Flash Player 9
Rotating device fonts using flash actionscript
package druva{
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFormat;
public class textEffect extends Sprite {
public function textEffect () {
for (var i:int = 2; i <= 12; i++) {
var txt:TextField = new TextField();
txt.selectable = false;
txt.width = 400;
txt.text = "www.flashallys.com/blog";
txt.setTextFormat(new TextFormat("Georgia", 2*i,(2 + 0.35*i) * 0xCCCC00,false,true ));
txt.x = 4.5*(i*(i+1)/2);
txt.y = 3*(i*(i+2)/2);
txt.rotationZ = 20;
addChild(txt);
}
}
}
}
This movie requires Flash Player 9
Image rotating in Y direction with tweener using flash actionscript
To see the effect please click on the below image
import caurina.transitions.Tweener;
var values:int=0;
heart.addEventListener(MouseEvent.MOUSE_DOWN,rotate);
function rotate(evt:MouseEvent):void
{
values = values - 1;
Tweener.addTween(heart,{rotationX:values*0,rotationY:values*180,time:1,transition:"easeInCubic"});
}
This movie requires Flash Player 9
Image rotating in X direction with tweener using flash actionscript
To see the effect please click on the below image
import caurina.transitions.Tweener;
var values:int=0;
heart.addEventListener(MouseEvent.MOUSE_DOWN,rotate);
function rotate(evt:MouseEvent):void
{
values = values - 1;
Tweener.addTween(heart,{rotationX:values*180,rotationY:values*0,time:1,transition:"easeInCubic"});
}
This movie requires Flash Player 9