简体   繁体   中英

Updating to latest AIR v3.8 causes SWFs loaded from disk to malfunction

We have an existing application where, if our users auto-update to Adobe AIR v3.8 it causes interactive SWFs that are loaded from the local disk into an HtmlLoader instance to not function properly. The mouse cursor is stuck in the corner of the window and will not move. I have narrowed the problem down to something in the HTML that we are loading. If the wmode property is changed from "opaque" to "window" the mouse works. If left as shown below wmode="opaque" the mouse cursor will not move.

The SWFs that we are loading in have been coded by various people to varying degrees of quality. In order to protect our application from varying coding practices we 'sandbox' them by using an HTMLLoader instance which loads an HTML file which in turn loads the SWF. This prevents the loaded SWF from walking up to the parent app (our AIR app) and doing unpleasant things like messing with the mouse. This has worked just fine for several years. Now, these SWFs do not work correctly.

Below is the code we are using to set up the HTMLLoader, and below that is the HTML.

` import core.abstract.ICoreFactory; import core.abstract.ui.IInteractiveRewardPlayer; import core.concrete.Instances;

import domain.curriculum.Reward;

import flash.display.DisplayObject;
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.html.HTMLLoader;
import flash.net.URLRequest;

import mx.containers.Canvas;
import mx.containers.VBox;
import mx.core.UIComponent;
import mx.logging.*;

public class InteractiveRewardContainer extends Canvas implements IInteractiveRewardPlayer
{       

    private static var _logger:ILogger = Log.getLogger("InteractiveRewardContainer");   
    private var _html:HTMLLoader;   
    public function InteractiveRewardContainer()
    {
        super();
    }

    public function addToDisplay(container:VBox):void
    {
        container.addChild(this);
    }

    public function startReward(reward:Reward, width:int, height:int):void
    {
        _html = new HTMLLoader();
        var bitmapHolder:UIComponent = new UIComponent();
        var mySprite:Sprite = new Sprite();

        var file:String = Instances.coreFactory.resourceLoader.returnHTMLRewardFileName(reward);
        _logger.info("File=" + file);
        var urlReq:URLRequest = new URLRequest(file);

        bitmapHolder.addChild(_html);
        _html.width = width;
        _html.height = height;
        _html.load(urlReq);
        mySprite.addChild(_html);
        bitmapHolder.addChild(mySprite);
        this.addChild(bitmapHolder);    

        this.width = width;
        this.height = height;
    }

    public function stopReward():void
    {   
        _html.loadString("<html></html>");
    }
}

`

and a portion of the HTML. Note the wmode attribute. Changing it to "window" fixes the mouse problem, but then we have a display problem. <embed src="76381.swf" quality="high" bgcolor="#869ca7" id="RightClickDemo" width="100%" height="100%" name="Bicycle" align="middle" menu="false" play="true" loop="false" quality="high" wmode="opaque" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" /> Any ideas what we can do to fix this issue?

在HTML中将wmode设置为“ direct”可以解决鼠标问题,并且还可以保持正确的显示。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM