I have a movie in as3 with the following code on the first frame in the main timeline and I am trying to conver it in as2 so i can output it with swiffy however I guess I have something wrong in the code as I am getting an empty screen…
any comments or help ?
AS3
stop();
import com.greensock.*;
import com.greensock.easing.*;
import fl.transitions.Tween;
import flash.display.MovieClip;
import flash.display.Bitmap;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
//add progress event listener for loading and completion
loaderInfo.addEventListener(ProgressEvent.PROGRESS, movieLoading);
loaderInfo.addEventListener(Event.COMPLETE, movieLoaded);
preloader.x = stage.stageWidth / 2;
preloader.y = stage.stageHeight / 2;
TweenLite.to(preloader,2,{ alpha:1,ease:Expo.easeOut});
function movieLoading(event:ProgressEvent):void
{
var dataBytesLoaded:Number = event.bytesLoaded / event.bytesTotal * 100;
/*
we are targeting the bar clip inside preloader MovieClip instance on stage
Bar will scale along the x-axis as per loaded bytes percent.
*/
preloader.percent.text = int(dataBytesLoaded) + "%";
/*
we are targeting the logo mask inside preloader.logo movieClip instance on stage
mask will scale along the Y-axis as per loaded bytes percent to reveal the Logo
image underneath it to create a nice custom preloader effect.
*/
}
function resizeListener(e:Event):void
{
buildStage();
}
function movieLoaded(event:Event):void
{
TweenLite.to(preloader,2,{ alpha:0,ease:Expo.easeOut});
//send the movie to frame 2 or.do whatever you want to.;
firstTimeOnly();
}
function firstTimeOnly():void
{
circleP.x = - circleP.width;
circleP.y = stage.stageHeight / 2;
circleP.alpha = 0;
p_info.x = stage.stageWidth / 2;
p_info.y = circleP.y - circleP.height / 2 - 70;
p_info.alpha = 0;
circleO.x = stage.stageWidth + circleO.width;
circleO.y = stage.stageHeight / 2;
circleO.alpha = 0;
o_info.x = stage.stageWidth / 2;
o_info.y = circleP.y - circleP.height / 2 - 70;
o_info.alpha = 0;
logo.x = stage.stageWidth / 2;
logo.y = stage.stageHeight + logo.height;
logo.alpha = 0;
facebook_mc.x = stage.stageWidth - facebook_mc.width - 10;
facebook_mc.y = facebook_mc.height + 10;
facebook_mc.alpha = 0;
TweenLite.to(preloader,3,{alpha:0,ease:Expo.easeOut});
buildStage();
}
function buildStage():void
{
stage.addEventListener(Event.RESIZE, resizeListener);
o_info.alpha = 0;
p_info.alpha = 0;
TweenLite.to(logo,3,{alpha:1,x:stage.stageWidth/ 2,y:stage.stageHeight - logo.height/2 ,ease:Expo.easeOut});
TweenLite.to(circleP,3,{delay:2,alpha:.5,x:stage.stageWidth/ 2 - 10,y:stage.stageHeight/2,ease:Expo.easeOut,onComplete:Penelope});
TweenLite.to(circleO,3,{delay:2,alpha:.5,x:stage.stageWidth/ 2 + 10,y:stage.stageHeight/2 ,ease:Expo.easeOut,onComplete:Oracle});
TweenLite.to(facebook_mc,1,{delay:3,alpha:1,x:stage.stageWidth - facebook_mc.width - 10,y:facebook_mc.height + 30,ease:Expo.easeOut});
}
import com.greensock.*;
import com.greensock.easing.*;
import fl.transitions.Tween;
import flash.sampler.NewObjectSample;
function Penelope():void
{
p_info.x = stage.stageWidth / 2;
circleP.buttonMode = true;
circleP.addEventListener(MouseEvent.CLICK, PfishBtn);
circleP.addEventListener(MouseEvent.MOUSE_OVER, PMouseOver);
circleP.addEventListener(MouseEvent.MOUSE_OUT, PMouseOut);
function PfishBtn(e:Event):void
{
var url:String = "http://www.rubber-bodies.com/penelope.html";
var request:URLRequest = new URLRequest(url);
try
{
navigateToURL(request, '_self');
}
catch (e:Error)
{
trace("Error occurred!");
}
}
function PMouseOver(e:Event):void
{
TweenLite.to(circleP,3,{alpha:1, ease:Expo.easeOut});
TweenLite.to(p_info,3,{alpha:1, ease:Expo.easeOut});
}
function PMouseOut(e:Event):void
{
TweenLite.to(circleP,1,{alpha:.5, ease:Expo.easeOut});
TweenLite.to(p_info,1,{alpha:0, ease:Expo.easeOut});
}
}
function Oracle():void
{
o_info.x = stage.stageWidth / 2;
circleO.buttonMode = true;
circleO.addEventListener(MouseEvent.CLICK, OfishBtn);
circleO.addEventListener(MouseEvent.MOUSE_OVER, OMouseOver);
circleO.addEventListener(MouseEvent.MOUSE_OUT, OMouseOut);
function OfishBtn(e:Event):void
{
var url:String = "http://www.rubber-bodies.com/oracle.html";
var request:URLRequest = new URLRequest(url);
try
{
navigateToURL(request, '_self');
}
catch (e:Error)
{
trace("Error occurred!");
}
}
function OMouseOver(e:Event):void
{
TweenLite.to(circleO,3,{alpha:1, ease:Expo.easeOut});
TweenLite.to(o_info,3,{alpha:1, ease:Expo.easeOut});
}
function OMouseOut(e:Event):void
{
TweenLite.to(circleO,1,{alpha:.5, ease:Expo.easeOut});
TweenLite.to(o_info,1,{alpha:0, ease:Expo.easeOut});
}
}
AS2
import mx.transitions.Tween;
import mx.transitions.easing.*;
import flash.display.StageScaleMode;
import flash.display.MovieClip;
import flash.display.StageAlign;
import mx.events.*;
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
var total:Number;
var loaded:Number;
preloader._alpha = 0;
var stageListener:Object = new Object();
Stage.addListener(stageListener);
this.onEnterFrame = function()
{
total = _root.getBytesTotal();
loaded = _root.getBytesLoaded();
preloader.x = Stage.width / 2;
preloader.y = Stage.height / 2;
new Tween(preloader, "_alpha", Regular.easeOut, 1, 1, 3, true);
if (loaded >= total)
{
delete (onEnterFrame);
movieLoaded();
}
};
function movieLoaded():Void
{
new Tween(preloader, "_alpha", Regular.easeOut, 0, 0, 3, true);
//send the movie to frame 2 or.do whatever you want to.;
firstTimeOnly();
}
function firstTimeOnly():Void
{
circleP._x = -circleP._width;
circleP._y = Stage.height / 2;
circleP._alpha = 0;
p_info._x = Stage.width / 2;
p_info._y = circleP._y - circleP._height / 2 - 70;
p_info._alpha = 0;
circleO._x = Stage.width + circleO._width;
circleO._y = Stage.height / 2;
circleO._alpha = 0;
o_info._x = Stage.width / 2;
o_info._y = circleP._y - circleP._height / 2 - 70;
o_info._alpha = 0;
logo._x = Stage.width / 2;
logo._y = Stage.height + logo._height;
logo._alpha = 0;
facebook_mc._x = Stage.width - facebook_mc._width - 10;
facebook_mc._y = facebook_mc._height + 10;
facebook_mc._alpha = 0;
new Tween(preloader, "_alpha", Regular.easeOut, 0, 0, 3, true);
buildStage();
}
function buildStage():Void
{
stageListener.onResize = setStage;
o_info._alpha = 0;
p_info._alpha = 0;
logo._x = Stage.width / 2;
logo._y = Stage.height - logo._height / 2;
circleP._x = Stage.width / 2 - 10;
circleP._y = Stage.height / 2;
circleO._x = Stage.width / 2 + 10;
circleO._y = Stage.height / 2;
facebook_mc._x = Stage.width - facebook_mc._width - 10;
facebook_mc._y = facebook_mc._height + 30;
new Tween(logo, "_alpha", Regular.easeOut, 0, 1, 3, true);
new Tween(circleP, "_alpha", Regular.easeOut, 0, 1, 3, true);
new Tween(circleO, "_alpha", Regular.easeOut, 0, 1, 3, true);
new Tween(facebook_mc, "_alpha", Regular.easeOut, 0, 1, 3, true);
}
function Penelope():Void
{
p_info._x = Stage.width / 2;
circleP.buttonMode = true;
circleP.onRollOver = function()
{
new Tween(circleP, "_alpha", Regular.easeOut, 1, 1, 3, true);
new Tween(p_info, "_alpha", Regular.easeOut, 1, 1, 3, true);
};
circleP.onRollOut = function()
{
new Tween(circleP, "_alpha", Regular.easeOut, 1, 1, 3, true);
new Tween(p_info, "_alpha", Regular.easeOut, 1, 0, 3, true);
};
circleP.onRelease = function()
{
getURL("http://www.rubber-bodies.com/penelope.html");
};
}
function Oracle():Void
{
o_info._x = Stage.width / 2;
circleO.buttonMode = true;
circleO.onRollOver = function()
{
new Tween(circleO, "_alpha", Regular.easeOut, 1, 1, 3, true);
new Tween(o_info, "_alpha", Regular.easeOut, 1, 1, 3, true);
};
circleO.onRollOut = function()
{
new Tween(circleO, "_alpha", Regular.easeOut, 1, 1, 3, true);
new Tween(o_info, "_alpha", Regular.easeOut, 1, 0, 3, true);
};
circleO.onRelease = function()
{
getURL("http://www.rubber-bodies.com/oracle.html");
};
}