download AS3
http://www.mediafire.com/?41i2q688jr23p
stop();
loaderInfo.addEventListener(ProgressEvent.PROGRESS, progressListener);
loaderInfo.addEventListener(Event.COMPLETE, completeListener);
function progressListener(e:ProgressEvent):void {
var loaded:Number = e.bytesLoaded / e.bytesTotal;
var percent:int = loaded * 100;
yload.loadN.text = "" + percent + "%";
//loadingBar.scaleX = loaded;
}
function completeListener(e:Event):void {
loaderInfo.removeEventListener(ProgressEvent.PROGRESS, progressListener);
loaderInfo.removeEventListener(Event.COMPLETE, completeListener);
//gotoAndPlay("menu", "Scene 1");
play();
}
------------
//AS2 code
percentageLoaded = Math.round(_root.getBytesLoaded() / _root.getBytesTotal() * 100);
per = int(percentageLoaded);
percentage = per+"%";
if (percentageLoaded == 100) {
gotoAndPlay("Start");
} else {
gotoAndPlay("LoadMore");
}
//Another //<------ AS3 Code ----->
var contentMc:MovieClip;
var myLoader:Loader = new Loader();
myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressListener);
myLoader.contentLoaderInfo.addEventListener(Event.INIT, initListener);
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeListener);
myLoader.load(new URLRequest("MovieToLoad.swf"));
// loading in progress
function progressListener(event:ProgressEvent):void {
// do something with the preloader
var percentLoaded:Number = event.bytesLoaded/event.bytesTotal;
percentLoaded = Math.round(percentLoaded * 100);
trace("loaded " + percentLoaded.toString()+"%");
// this test is necessary because the content may not be yet initialized
if(contentMc != null) {
trace("Loaded " + contentMc.framesLoaded + " frames of " + contentMc.totalFrames);
} else {
trace("Movie not yet initialized...");
}
}
// content initialized
function initListener (e:Event):void {
// from here I can use the loaded content
contentMc = MovieClip(myLoader.content);
addChild(contentMc);
contentMc.gotoAndStop(1);
trace("Total number of frames: " + contentMc.totalFrames);
}
// loading complete
function completeListener(event:Event):void {
// some code here...
}
Sound play/pause
//AS3 code
download file - http://www.mediafire.com/?gcvx8s16ui2id0z
var pausePoint:Number = 0.00;
var isPlaying:Boolean;
var soundChannel:SoundChannel = new SoundChannel();
var mySound:Sound = new mySong();
isPlaying = true;
soundChannel = mySound.play();
play_btn.addEventListener(MouseEvent.CLICK, MP3_music);
function MP3_music(event:MouseEvent):void {
if (isPlaying) {
pausePoint = soundChannel.position;
soundChannel.stop();
isPlaying = false;
} else {
soundChannel = mySound.play(pausePoint);
isPlaying = true;
}
}
// AS2 code
var snd1mc:MovieClip = this.createEmptyMovieClip("snd1mc",this.getNextHighestDepth());
var rakSound:Sound = new Sound(snd1mc);
rakSound.attachSound("rakbacksound");
rakSound.start(0,999);
rakSound.setVolume(25);
on (release) {
play();
fastsaver_m.play();
btn_stop._visible = true ;
btn_play._visible = false ;
_root.rakSound.start(myMusicPosition,0);
}
on (release) {
stop();
fastsaver_m.stop();
btn_stop._visible = false ;
btn_play._visible = true ;
myMusicPosition=_root.rakSound.position/1000;
_root.rakSound.stop("rakbacksound");
}
download file - http://www.mediafire.com/?gcvx8s16ui2id0z
var pausePoint:Number = 0.00;
var isPlaying:Boolean;
var soundChannel:SoundChannel = new SoundChannel();
var mySound:Sound = new mySong();
isPlaying = true;
soundChannel = mySound.play();
play_btn.addEventListener(MouseEvent.CLICK, MP3_music);
function MP3_music(event:MouseEvent):void {
if (isPlaying) {
pausePoint = soundChannel.position;
soundChannel.stop();
isPlaying = false;
} else {
soundChannel = mySound.play(pausePoint);
isPlaying = true;
}
}
// AS2 code
var snd1mc:MovieClip = this.createEmptyMovieClip("snd1mc",this.getNextHighestDepth());
var rakSound:Sound = new Sound(snd1mc);
rakSound.attachSound("rakbacksound");
rakSound.start(0,999);
rakSound.setVolume(25);
on (release) {
play();
fastsaver_m.play();
btn_stop._visible = true ;
btn_play._visible = false ;
_root.rakSound.start(myMusicPosition,0);
}
on (release) {
stop();
fastsaver_m.stop();
btn_stop._visible = false ;
btn_play._visible = true ;
myMusicPosition=_root.rakSound.position/1000;
_root.rakSound.stop("rakbacksound");
}
easing
import fl.transitions.Tween;
import fl.transitions.easing.*;
import flash.events.MouseEvent;
import flash.events.Event;
var prevX:int = 0;
var curX:int = 0;
var dirX:String = "";
function Start()
{
stage.addEventListener(MouseEvent.MOUSE_MOVE, CheckDirection);
}
Start();
function CheckDirection(e:MouseEvent)
{
var xDirection:String = GetHorizontalDirection();
e.updateAfterEvent();
}
function GetHorizontalDirection():String
{
var myTween:Tween;
curX = mouseX;
if (600 >= curX)
{
myTween = new Tween(buttoni,"x",None.easeOut,buttoni.x,-240,3,true);
}
if (300 <= curX) { myTween = new Tween(buttoni,"x",None.easeIn,buttoni.x,300,3,true); } return dirX; }