# Brain is broken, stuck on loading variables

**URL:** <https://forum.kirupa.com/t/brain-is-broken-stuck-on-loading-variables/182838>\
**Category:** flash\
**Created:** [March 21, 2006, 9:01pm UTC](https://forum.kirupa.com/t/brain-is-broken-stuck-on-loading-variables/182838 "2006-03-21T21:01:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![popstalin](https://avatars.discourse-cdn.com/v4/letter/p/e47c2d/32.png) [@popstalin](https://forum.kirupa.com/u/popstalin)\
**Post date:** [March 21, 2006, 9:01pm UTC](https://forum.kirupa.com/t/brain-is-broken-stuck-on-loading-variables/182838/1 "2006-03-21T21:01:04Z")

</div>

I have a Flash Video custom player skin thingy that I’ve created that plays 4 different videos. Now they want to add a “Download Video” link and for the life of me, I can’t figure out how to populate the URL to each video. Here’s the AS I have so far:

```auto

//Movieclip GotoAndStop Behavior
    gotoAndStop(1);
//End Behavior
    
play_button_0.onRelease = function() {
    video1.unloadMovie();
    video2.unloadMovie();
    video3.unloadMovie();
    _root.attachMovie("VSMediaDisplay", "video0", 50);
    video0.directLink = "URL to Video";
    video0.autoPlay = true;
    video0.backgroundColor = "#000000";
    video0.bufferTime = "4";
    video0.scaling = "keepRatio";
    video0.loop = 0;
    video0.detectBandwidth = "client";
    video0.volume = 100;
    video0._width = 240;
    video0._height = 180;
    video0._x = 5;
    video0._y = 4;
    
}

play_button_1.onRelease = function() {
    video0.unloadMovie();
    video2.unloadMovie();
    video3.unloadMovie();
    _root.attachMovie("VSMediaDisplay", "video1", 50);
    video1.directLink = "URL to Video";
    video1.autoPlay = true;
    video1.backgroundColor = "#000000";
    video1.bufferTime = "4";
    video1.scaling = "keepRatio";
    video1.loop = 0;
    video1.detectBandwidth = "client";
    video1.volume = 100;
    video1._width = 240;
    video1._height = 180;
    video1._x = 5;
    video1._y = 4;
}

play_button_2.onRelease = function() {
    video0.unloadMovie();
    video1.unloadMovie();
    video3.unloadMovie();
    _root.attachMovie("VSMediaDisplay", "video2", 50);
    video2.directLink = "URL to Video";
    video2.autoPlay = true;
    video2.backgroundColor = "#000000";
    video2.bufferTime = "4";
    video2.scaling = "keepRatio";
    video2.loop = 0;
    video2.detectBandwidth = "client";
    video2.volume = 100;
    video2._width = 240;
    video2._height = 180;
    video2._x = 5;
    video2._y = 4;
}

play_button_3.onRelease = function() {
    video0.unloadMovie();
    video1.unloadMovie();
    video2.unloadMovie();
    _root.attachMovie("VSMediaDisplay", "video3", 50);
    video3.directLink = "URL to Video";
    video3.autoPlay = true;
    video3.backgroundColor = "#000000";
    video3.bufferTime = "4";
    video3.scaling = "keepRatio";
    video3.loop = 0;
    video3.detectBandwidth = "client";
    video3.volume = 100;
    video3._width = 240;
    video3._height = 180;
    video3._x = 5;
    video3._y = 4;
}

```

Below is a wireframe of the player. When the individual links are clicked (which are a total of 4) the current movie is unloaded and the new movie is loaded. I need a link to download the video to be unique to each video.  
 ![](http://img477.imageshack.us/img477/6641/videoplayerwire3wz.gif)

Can anyone provide some assistance? I had a lot of help with the above code and though I think I know what’s supposed to happen, I just can’t get my head around it. Thanks!

---

<div class="post-metadata">

**Author:** ![rhamej](https://avatars.discourse-cdn.com/v4/letter/r/bb73d2/32.png) [@rhamej](https://forum.kirupa.com/u/rhamej)\
**Post date:** [March 21, 2006, 9:03pm UTC](https://forum.kirupa.com/t/brain-is-broken-stuck-on-loading-variables/182838/2 "2006-03-21T21:03:57Z")

</div>

You need to zip up the videos and use getURL to link to the zip files. If you just use a getURL directly to the video, the default player will just open and play the file.

---

<div class="post-metadata">

**Author:** ![popstalin](https://avatars.discourse-cdn.com/v4/letter/p/e47c2d/32.png) [@popstalin](https://forum.kirupa.com/u/popstalin)\
**Post date:** [March 21, 2006, 9:13pm UTC](https://forum.kirupa.com/t/brain-is-broken-stuck-on-loading-variables/182838/3 "2006-03-21T21:13:04Z")

</div>

The videos are streamed from Vital Stream, does that make a difference? The downloadable videos are hosted on Akamai, so they are already zipped, we just need to provide a link.

---

<div class="post-metadata">

**Author:** ![daleth](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/daleth/32/1096_2.png) [@daleth](https://forum.kirupa.com/u/daleth)\
**Post date:** [March 21, 2006, 11:24pm UTC](https://forum.kirupa.com/t/brain-is-broken-stuck-on-loading-variables/182838/4 "2006-03-21T23:24:32Z")

</div>

I’m assuming you have the URLs to the files. There are a lot of different ways you could do this. This might be the fastest/simplest:

make a new property for each button that holds the url to that button’s video, i.e.,

button\_1.url = “[http://whatever](http://whatever)”;  
button\_2.url = … etc

then in the onRelease for each button, add:

getURL(this.url);

(or however you want to handle that).

That should be all you need.

---

<div class="post-metadata">

**Author:** ![popstalin](https://avatars.discourse-cdn.com/v4/letter/p/e47c2d/32.png) [@popstalin](https://forum.kirupa.com/u/popstalin)\
**Post date:** [March 22, 2006, 12:41am UTC](https://forum.kirupa.com/t/brain-is-broken-stuck-on-loading-variables/182838/5 "2006-03-22T00:41:18Z")

</div>

Is there no way to have one button with a dynamic text field that would accomplish the same thing? There is only one “Download Video” button.

Thanks again!
