Important: Please read the Qt Code of Conduct -

[solved] QWebView loads Flash swf fine, but only "randomly" loads images loaded by a flash file

  • Hello,

    I succesfully load and display a flash swf file. But I also do load images using code of the following style - dynamically into the swf file for display.

    Actionscript 3 loading code:
    @var logoUrl:URLRequest = new URLRequest("icons/logo.png");
    var logoLoader:Loader = new Loader();
    logoLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, addLogo, false, 0, true);
    logoLoader.load( logoUrl );

    function addLogo(evt:Event) {
    var logo:Bitmap =;
    logo.x = 110;
    logo.y = 330;
    logo.scaleX = 0.25;
    logo.scaleY = 0.25;

    But there is an issue that, "randomly", the images loaded by the swf become displayed, othertimes not. This can mean, 6 times yes, 2 times not. Also sometimes theres only one image loaded instead of all included. The loading routine in the flash file is happening in frame number 1.

    I also tried to increase the amount of frames in the flash swf up to 250 frames / 25 fps, 10 seconds to ensure that there are enough frames in the flash file to give the loader instances time to process the data loading.

    But an XML file loaded using a regular "Loader", instead of "URLLoader", class always becomes loaded and extracted succesfully.

    Now, Im just not sure where exactly the problem lies on - in the QWebview loading or the swf file itself.

    I should notice that the webview has some settings, those are:
    QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true);
    QWebSettings::globalSettings()->setAttribute(QWebSettings::PrivateBrowsingEnabled, true);
    QWebSettings::globalSettings()->setAttribute(QWebSettings::DnsPrefetchEnabled, false);
    QWebSettings::globalSettings()->setAttribute(QWebSettings::JavascriptEnabled, true);
    QWebSettings::globalSettings()->setAttribute(QWebSettings::AutoLoadImages, true);

  • [quote author="Jan Riechers" date="1410508863"]Hello,

    Actionscript 3 loading code:
    logoLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, addLogo, false, 0, true);

    It seems I found the issue, maybe that helps someone else:
    Dont use "weak reference", last parameter, for the addEventListener,
    this should look like this:
    @logoLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, addLogo, false, 0, false);@

    Amount of frames, one/1 is enough.

Log in to reply