# Help!?

**URL:** <https://forum.kirupa.com/t/help/258551>\
**Category:** Uncategorized\
**Created:** [April 24, 2008, 10:27pm UTC](https://forum.kirupa.com/t/help/258551 "2008-04-24T22:27:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bombdigiti](https://avatars.discourse-cdn.com/v4/letter/b/b5ac83/32.png) [@bombdigiti](https://forum.kirupa.com/u/bombdigiti)\
**Post date:** [April 24, 2008, 10:27pm UTC](https://forum.kirupa.com/t/help/258551/1 "2008-04-24T22:27:18Z")

</div>

Hey all, im having a ton of troubles converting an as2 cms flash file to as3. Its a project that is causing a lot of troubles. I’ve learned mainly as2 so is getting frustrating. I would love any help or suggestions on the attempt i’ve made at converting it. If you are wondering why i am trying to do this… im doing some papervision stuff for my project and its only as3. thanks in advanced. There is a lot to do… so some pointers would be awesome.

POOR ATTEMPT AT CONVERTING:

//importing  
import flash.events._;  
import [flash.net](http://flash.net)._;  
import fl.transitions.Tween;  
import fl.transitions.easing.\*;  
import fl.transitions.TweenEvent;

//setting variables  
root.played = 0;  
root.imagecount = 1;  
root.caniplay = 0;  
root.canishowthesongs = 0;  
root.canishowthevids = 0;  
root.vidplaying = 0;  
root.titletext = “”;  
root.infotext = “”;

var mytext:Loader = new Loader();  
var url:String = “[http://localhost/media\_gallery/loadinfo.php](http://localhost/media_gallery/loadinfo.php)”;  
var urlReq:URLRequest = new URLRequest(url);  
mytext.load(urlReq);  
mytext.onLoad = function(success) {  
if (success) {  
imagearray = mytext.images.split("|");  
galleryinfoarray = mytext.galleryinfo.split("|");  
gallerytitlearray = mytext.gallerytitles.split("|");  
galleryarray = mytext.galleryimages.split("|");  
numimages = imagearray.length;  
audioarray = mytext.audio.split("|");  
audionamearray = mytext.audioname.split("|");  
audioartistarray = mytext.audioartist.split("|");  
videoarray = mytext.videos.split("|");  
videonamearray = mytext.videoname.split("|");  
videoinfoarray = mytext.videoinfo.split("|");  
mysound = new Sound();  
mysound.loadSound(root.audioarray[0],true);  
mysound.stop();  
volumelevel = 100;  
}  
};

function moveSlider(xpos:Number, sliderwidth:Number) {  
var xPosT:Tween = new Tween(slider, “x”, Regular.easeOut, slider.x, xpos, 2, true);  
var wPosT:Tween = new Tween(slider, “width”, Regular.easeOut, slider.width, sliderwidth, 2, true);  
}

photoSelectAnimation.addEventListener(TweenEvent.MOTION\_FINISH, onMotionFinished);

function photoSelectAnimation(objalph:Number, xpos:Number, textInfo:String) {  
removeTracks();  
[//root.titletext](https://root.titletext) = “”;  
[//root.infotext](https://root.infotext) = “”;  
var slideDown:Tween = new Tween(slider2, “scaleY”, Regular.easeOut, slider2.scaleY, 105, 2, true);  
var slideAlpha:Tween = new Tween(slider2, “alpha”, Regular.easeOut, slider2.alpha, 15, 2, true);  
function onMotionFinished(event:TweenEvent):void {  
var aPosT1:Tween = new Tween(photoselect, “alpha”, Regular.easeIn, photoselect.alpha, objalph, 2, true);  
var aPosT2:Tween = new Tween(photoinfo, “alpha”, Regular.easeIn, photoinfo.alpha, objalph, 2, true);  
var aPosT3:Tween = new Tween(picture, “alpha”, Regular.easeIn, picture.alpha, objalph, 2, true);  
if (root.caniplay == 0) {  
loadImages();  
}  
};  
}  
videoSelectAnimation.addEventListener(TweenEvent.MOTION\_FINISH, onMotionFinished);

function videoSelectAnimation(objalph:Number, xpos:Number, textInfo:String) {  
var slideDown:Tween = new Tween(slider2, “scaleY”, Regular.easeOut, slider2.scaleY, 105, 2, true);  
var slideAlpha:Tween = new Tween(slider2, “alpha”, Regular.easeOut, slider2.alpha, 20, 2, true);  
function onMotionFinished(event:TweenEvent):void {  
var aPosT1:Tween = new Tween(videoselect, “alpha”, Regular.easeIn, videoselect.alpha, objalph, 2, true);  
var aPosT2:Tween = new Tween(photoinfo, “alpha”, Regular.easeIn, photoinfo.alpha, objalph, 2, true);  
var aPosT3:Tween = new Tween(video, “alpha”, Regular.easeIn, video.alpha, objalph, 2, true);  
var aPosT4:Tween = new Tween(stopvid, “alpha”, Regular.easeIn, 0, 100, 2, true);  
var aPosT5:Tween = new Tween(playvid, “alpha”, Regular.easeIn, 0, 100, 2, true);  
var aPosT6:Tween = new Tween(pausevid, “alpha”, Regular.easeIn, 0, 100, 2, true);  
if (root.canishowthevids == 0) {  
vidplayer.visible = true;  
vidplayer.contentPath = root.videoarray[0];  
root.titletext = root.videonamearray[0];  
root.infotext = root.videoinfoarray[0];  
loadVideos();  
vidplayer.stopButton = stopvid;  
vidplayer.playButton = playvid;  
vidplayer.pauseButton = pausevid;  
playvid.y = 261;  
pausevid.y = 261;  
stopvid.y = 261;  
}  
};  
}

audioSelectAnimation.addEventListener(TweenEvent.MOTION\_FINISH, onMotionFinished);

function audioSelectAnimation(objalph:Number, xpos:Number, textInfo:String) {  
removeThumbs();  
[//root.titletext](https://root.titletext) = “”;  
[//root.infotext](https://root.infotext) = “”;  
var slideDown:Tween = new Tween(slider2, “yscale”, Regular.easeOut, slider2.scaleY, 105, 2, true);  
var slideAlpha:Tween = new Tween(slider2, “alpha”, Regular.easeOut, slider2.alpha, 20, 2, true);  
function onMotionFinished(event:TweenEvent):void {  
var aPosT1:Tween = new Tween(audioselect, “alpha”, Regular.easeIn, audioselect.alpha, objalph, 2, true);  
var aPosT3:Tween = new Tween(photoinfo, “alpha”, Regular.easeIn, photoinfo.alpha, objalph, 2, true);  
var aPosT:Tween = new Tween(audio, “alpha”, Regular.easeIn, audio.alpha, objalph, 2, true);  
if (root.canishowthesongs == 0) {  
root.currenttrack = root.audionamearray[0];  
root.currentartist = root.audioartistarray[0];  
loadTracks();  
}  
};  
}  
function loadImages() {  
starty = 60;  
startx = 27;  
numthumbs = galleryarray.length;  
for (i=0; i\<numthumbs; i++) {  
count = i+1;  
if (count == 4 || count == 7) {  
starty += 67;  
startx = 27;  
}  
flash.display.MovieClip.MovieClip(“holder”, “thumb”+count, count);  
loadMovie(galleryarray\*, “thumb”+count);  
eval(“thumb”+count).y = starty;  
eval(“thumb”+count).x = startx;  
var aPosT:Tween = new Tween(eval(“thumb”+count), “alpha”, Regular.easeOut, 0, 100, 1, true);  
startx += 65;  
}  
}

function setText(num) {  
titletext = gallerytitlearray[num];  
infotext = galleryinfoarray[num];  
}

function removeThumbs() {  
for (i=1; i\<9; i++) {  
removeChild(“thumb”+i);  
}  
}

function loadTracks() {  
starty = 130;  
startx = 170;  
numtracks = root.audioarray.length-1;  
for (i=0; i\<numtracks; i++) {  
count = i+1;  
if (count == 5) {  
starty += 85;  
startx = 10;  
}  
flash.display.MovieClip.MovieClip(“trackholder”, “track”+count, count);  
eval(“track”+count).trackholder = root.audionamearray\*+" | "+root.audioartistarray\*;  
eval(“track”+count).y = starty;  
eval(“track”+count).x = startx;  
starty += 15  
}  
}

videobtn.buttonMode = true;  
videobtn.addEventListener(MouseEvent.MOUSE\_OVER, mouseOverVideo);

function mouseOverVideo(event:MouseEvent):void {  
trace(“videobtnselected”);  
moveSlider(12,36);  
}

photobtn.buttonMode = true;  
photobtn.addEventListener(MouseEvent.MOUSE\_OVER, mouseOverPhoto);

function mouseOverPhoto(event:MouseEvent):void {  
trace(“photobtnselected”);  
moveSlider(61,40);  
}

audiobtn.buttonMode = true;  
audiobtn.addEventListener(MouseEvent.MOUSE\_OVER, mouseOverAudio);

function mouseOverAudio(event:MouseEvent):void {  
trace(“audiobtnselected”);  
moveSlider(116,38);  
}

videobtn.onPress = function() {  
removeThumbs();  
sectiontitle = “Videos”;  
root.caniplay = 1;  
root.canishowthesongs = 1;  
root.canishowthevids = 0;  
slider2.scaleY = 15;  
slider2.alpha = 0;  
videoSelectAnimation(100,524);  
photoSelectAnimation(0,125);  
audioSelectAnimation(0,326);  
};  
photobtn.onPress = function() {  
if (vidplayer.bytesTotal\>-1) {  
removeVids();  
}  
playvid.\_y = 400;  
pausevid.\_y = 400;  
stopvid.\_y = 400;  
removeThumbs();  
sectiontitle = “Photos”;  
root.caniplay = 0;  
root.canishowthesongs = 1;  
root.canishowthevids = 1;  
slider2.scaleY = 15;  
slider2.alpha = 0;  
videoSelectAnimation(0,524);  
photoSelectAnimation(100,125);  
audioSelectAnimation(0,326);  
};  
audiobtn.onPress = function() {  
if (root.mysound.position == 0) {  
root.mysound.start();  
}  
if (vidplayer.bytesTotal\>-1) {  
removeVids();  
}  
playvid.y = 400;  
pausevid.y = 400;  
stopvid.y = 400;  
sectiontitle = “Audio”;  
root.canishowthesongs = 0;  
root.canishowthevids = 1;  
root.caniplay = 1;  
slider2.scaleY = 15;  
slider2.alpha = 0;  
videoSelectAnimation(0,524);  
photoSelectAnimation(0,125);  
audioSelectAnimation(100,326);  
};  
stopsound.onPress = function() {  
root.mysound.stop();  
thispoint = 0;  
};  
playsound.onPress = function() {  
root.mysound.start(thispoint);  
};  
pausesound.onPress = function() {  
thispoint = root.mysound.position/1000;  
root.mysound.stop();  
};

function removeTracks() {  
thismany = audioarray.length;  
for (i=1; i\<thismany; i++) {  
removeChild(“track”+i);  
}  
}

function loadVideos() {  
starty = 130;  
startx = 130;  
numvids = root.videoarray.length-1;  
for (i=0; i\<numvids; i++) {  
count = i+1;  
if (count == 4) {  
starty += 85;  
startx = 10;  
}  
flash.display.MovieClip.MovieClip(“vidholder”, “vid”+count, count);  
eval(“vid”+count).vidtext = root.videonamearray\*;  
eval(“vid”+count).y = starty;  
eval(“vid”+count).x = startx;  
starty += 15;  
}  
}

function removeVids() {  
thismany = videoarray.length;  
vidplayer.visible = false;  
vidplayer.stop();  
for (i=1; i\<thismany; i++) {  
removeChild(“vid”+i);  
}  
}
