# Dowhile document opens

**URL:** <https://forum.kirupa.com/t/dowhile-document-opens/2629>\
**Category:** Uncategorized\
**Created:** [May 20, 2002, 2:59pm UTC](https://forum.kirupa.com/t/dowhile-document-opens/2629 "2002-05-20T14:59:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 20, 2002, 2:59pm UTC](https://forum.kirupa.com/t/dowhile-document-opens/2629/1 "2002-05-20T14:59:01Z")

</div>

I’m using Flash to create an interface that links to various Word, PowerPoint, and PDF’s (that open in a new window). However some documents are quite large, and take several seconds to open. How can I tell the user that the document is opening, and not to KEEP CLICKING THE LINK!!?? Can I have something akin to the hourglass pop up? Is this a dowhile function? Any advice.

Thanks

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 20, 2002, 9:10pm UTC](https://forum.kirupa.com/t/dowhile-document-opens/2629/2 "2002-05-20T21:10:55Z")

</div>

getting the download progress from another browser window sounds a little complicated to me.

what you might do instead is disable the button for however long.

here’s one method of doing that. make a testing movie in \_root, call it “test”. we’ll toggle that button’s visiblilty in the example.

on your button, you add a few lines to disable the button, and re-enable it a little later:

```auto
  
on(release){
_ _ _ _ // toggle test's visiblility
_ _ _ _ _root.test._visible = !_root.test._visible;
_ _ _ _ this.myButton.enabled = 0;
_ _ _ _ this.myButton.timeOut = setInterval(_root.reEnable,1000,this.myButton);
}

```

the setInterval arguments are; the function to call, how often to call it, and any arguments you want to pass to that function. in this case, we’re calling \_root.reEnable every second (1000 milliseconds, you’ll probably wnat to make that longer) and passing it the a reference to the button which we’ve disabled (which also contains the handler for the setInterval).

and we’ll need to write that reEnable function that we called:

```auto
  
function reEnable(button){
_ _ _ _ trace("cleared "+button+"'s interval!")
_ _ _ _ button.enabled = 1;
_ _ _ _ clearInterval(button.timeOut);
}

```

pretty straightforward, it re-enables the button, and clears the setInterval using the handler we defined. handy how each button can contain it’s own handler, eh? no overlaps.

- edit\*

oh yeah, you’ll need to name your buttons too, in the above example, i’ve named the button “myButton”.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 20, 2002, 9:25pm UTC](https://forum.kirupa.com/t/dowhile-document-opens/2629/3 "2002-05-20T21:25:46Z")

</div>

Hey Supra, this is the Flash 5 forum !! Not Flash MX. Apart from that, I don’t know how that setInterval function works, but isn’t it strange that you call setInterval(\_root.reEnable,1000,this.myButton) and then define function reEnable(button). Where has the 1000 gone ?

pom 0]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 20, 2002, 9:38pm UTC](https://forum.kirupa.com/t/dowhile-document-opens/2629/4 "2002-05-20T21:38:11Z")

</div>

actually, ily, this is the actionscripting forum. ; )

the 1000 defines how often the function will be called until it’s cleared. since the function clears itself, it only runs once. in this case, it’s more of a delay than an interval.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 20, 2002, 10:57pm UTC](https://forum.kirupa.com/t/dowhile-document-opens/2629/5 "2002-05-20T22:57:50Z")

</div>

Oh, I see…

pom 0]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 22, 2002, 3:43pm UTC](https://forum.kirupa.com/t/dowhile-document-opens/2629/6 "2002-05-22T15:43:32Z")

</div>

thanks all.
