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
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:
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:
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.
oh yeah, you’ll need to name your buttons too, in the above example, i’ve named the button “myButton”.
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]
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.