Hi Maria,

Perhaps it's the same issue I had with autoplay on videos. Some browser need a user gesture event to enable it. Do you tried to add clic event to be sure that the browse method is called in a user clic case ?

If it may help here is my working code :

<j:IconButton click="{ev_clic_choose_file(event)}" ...../>
....

public function ev_clic_choose_file2(e:MouseEvent):void {

 var videosFilter:FileFilter = new FileFilter("Vidéo", "*.mp4;*.f4v");
 _fr = new FileReferenceMulti();
 _fr_index = 0;
 _fr.browse([videosFilter]);
 _fr.addEventListener(Event.COMPLETE, uploadCompleteHandler);
 _fr.addEventListener(Event.SELECT, ev_SelectedFile);
}

Le 2025-04-14 18:42, Maria Jose Esteve a écrit :

Hi,
I need your help because I'm stuck.
In one of my applications, I use mx.net.FileReference to select a user's photo. It's always worked fine for me, but yesterday, while testing, I noticed that it stopped working in Chrome, although it still works as expected in Firefox. I'm not getting any errors, but I do see a warning in the debug console: "File chooser dialog can only be shown with a user activation." The traceback points to org.apache.royale.file.beads.FileBrowser in the browse() method:

public function browse():void
{
COMPILE::SWF
{
delegate.browse();
}
COMPILE::JS
{
focusedButton = document.activeElement as WrappedHTMLElement;
//trace("activeElement is: " + focusedButton);
focusedButton.addEventListener("blur", blurHandler);
focusedButton.addEventListener("focus", focusHandler);
window.addEventListener("keydown", keyHandler);
window.addEventListener("mousemove", mouseHandler);
window.addEventListener("mousedown", mouseHandler);
delegate.click(); // <<<<<<<<<< -------------------------- Error
}
}

I've verified that the delegate is still valid; it references the "input, type file" that's created.
Any ideas on how to fix this?

Thx.
Hiedra

Reply via email to