# Add one more video to flash file with as2

**URL:** <https://forum.kirupa.com/t/add-one-more-video-to-flash-file-with-as2/319308>\
**Category:** Uncategorized\
**Created:** [February 15, 2011, 10:18pm UTC](https://forum.kirupa.com/t/add-one-more-video-to-flash-file-with-as2/319308 "2011-02-15T22:18:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![maushoo](https://avatars.discourse-cdn.com/v4/letter/m/ce73a5/32.png) [@maushoo](https://forum.kirupa.com/u/maushoo)\
**Post date:** [February 15, 2011, 10:18pm UTC](https://forum.kirupa.com/t/add-one-more-video-to-flash-file-with-as2/319308/1 "2011-02-15T22:18:20Z")

</div>

I am trying to add one more video to a flash file that contains 2 already. I am new to actionscript, and have been actually learning as3. the file i need to update is in as2. it looks like its within the if else statements area, but i don’t know actionscript well enough to complete this. can anyone help, please? the code is below. the file recognizes a “slide1” and “slide4” right now, but i also need it to recognize a “slide5”. thanks!

**current code:**

function updatePosition()  
{  
if (\_root.\_xmouse \> Stage.width - 1 || \_root.\_xmouse \< 1)  
{  
stopDrag();  
delete (\_root.onEnterFrame);  
}  
var \_\_reg4 = 50;  
var \_\_reg3 = (\_root.arrow.\_x - 60) / \_root.bar.\_width;  
if (\_global.lastPercent != \_\_reg3)  
{  
gs.TweenMax.to(\_root.container, 1, {\_x: 0 - (\_root.container.\_width - 260) \* \_\_reg3 + \_\_reg4, ease: gs.easing.Cubic.easeOut, overwrite: true, onUpdate: optimize});  
}  
\_global.lastPercent = \_\_reg3;  
}  
function optimize()  
{  
i = 0;  
while (i \< \_root.container.totalSlides)  
{  
if (\_root.container[“slide” + i].hitTest(\_root.container\_mask) == true)  
{  
\_root.container[“slide” + i].\_visible = true;  
}  
else  
{  
\_root.container[“slide” + i].\_visible = false;  
}  
++i;  
}  
if (\_root.container.slide1.my\_video.hitTest(\_root.container\_mask) == true)  
{  
if (\_root.container.slide1.my\_video.isPlaying == false)  
{  
trace(“playing video 1”);  
gs.TweenMax.delayedCall(0.5, playVideo1);  
}  
\_root.container.slide1.my\_video.isPlaying = true;  
}  
else  
{  
gs.TweenMax.delayedCall(0.25, stopVideo1);  
\_root.container.slide1.my\_video.isPlaying = false;  
}  
if (\_root.container.slide4.my\_video.hitTest(\_root.container\_mask) == true)  
{  
if (\_root.container.slide4.my\_video.isPlaying == false)  
{  
trace(“playing video 2”);  
gs.TweenMax.delayedCall(0.5, playVideo2);  
}  
\_root.container.slide4.my\_video.isPlaying = true;  
return;  
}  
gs.TweenMax.delayedCall(0.25, stopVideo2);  
\_root.container.slide4.my\_video.isPlaying = false;  
}  
function stopVideo1()  
{  
\_root.container.slide1.my\_video.stop();  
}  
function setVolume()  
{  
trace(\_root.mySound.myVolume);  
}  
function playVideo1()  
{  
\_root.container.slide1.my\_video.play();  
}  
function stopVideo2()  
{  
\_root.container.slide4.my\_video.stop();  
}  
function playVideo2()  
{  
\_root.container.slide4.my\_video.play();  
}  
optimize();

arrow.onPress = function ()  
{  
startDrag(this, 0, 63, 635, 670, 635);  
\_root.onEnterFrame = function ()  
{  
updatePosition();  
}  
;  
}  
;  
arrow.onRelease = function ()  
{  
stopDrag();  
delete \_root.onEnterFrame;  
}  
;
