I have an <mx:HTML/> component in my flex air app that shows a web page. The problem is, if the web page has a link on it and they click it, it does not take them to that page. Is there a way to allow this, or a work around? is there a way for the loaded webpage to send Flex info about events that occur in it?
Here is my code:
<mx:HTML
id="html"
width="100%"
height="100%"
location="http://www.mywebsite.com/updates/help/"
locationChange="dispatchLocationChange(event)"
/>
Thanks!!
Do you have any other DisplayObjects handling mouse events that may be covering the HTML control, and blocking any clicks that it might receive? It seems that something may be interfering with the mouse events reaching your HTML content. I threw together a dirt-simple AIR app that loads some web content using the code above, and I'm not seeing any issues - everything appears to be working the way that it should:
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
private function dispatchLocationChange (e:Event):void
{
trace ("locationChange:", html.location);
}
]]>
</mx:Script>
<mx:HTML
id="html"
width="100%"
height="100%"
location="http://www.google.com/"
locationChange="dispatchLocationChange(event)"
/>
</mx:WindowedApplication>
Off the top of my head, I can't really think of anything else other than some issues with the HTML content itself that might be causing the problems. Have you tried loading other web content into the HTML control to see if you experience the same issues with different content?
Related
I am using FlashBuilder to create flash file to show video. Please see the following code:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="1280" minHeight="720">
<fx:Declarations>
<!-- Place non-visual elements here, for example, services and value objects -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
import org.osmf.net.StreamingURLResource; import org.osmf.net.FMSURL;
protected function vp_preinitializeHandler(event:FlexEvent): void
{
var myURL:StreamingURLResource = new StreamingURLResource("http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4");
myURL.urlIncludesFMSApplicationInstance = true;
myVideoPlayer.source = myURL;
}
]]>
</fx:Script>
<s:VideoPlayer id="myVideoPlayer" autoPlay="true" preinitialize="vp_preinitializeHandler(event)" x="2" y="2" height="100%" width="100%" />
</s:Application>
After clicking Menu >> Project >> "Export Release Build", FlashBuilder generates a swf file, which looks fine. However, I found that the swf file changed EVEN IF I did not change any code. This means, same code generates different swf files in each "Export Release Build" click. I used command line fc to compare the generated swf files and confirmed each file is different.
I installed FlashBuilder of the newest version (ver 4.7 from Adobe). I wonder why the same code generates different swf files, and what kind of information is included in those different swf files.
I have a Kaltura Html5 player embedded in a web page. The player is configured to use VAST/VPAID and a VAST tag is provided which returns the following:
<VAST xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0" xsi:noNamespaceSchemaLocation="vast_2.0.1-creativeView.xsd">
<Ad>
<InLine id="Viewbix">
<AdSystem>Viewbix</AdSystem>
<AdTitle>Viewbix VPAID Ad</AdTitle>
<Creatives>
<Creative sequence="1">
<Linear>
<Duration>00:04:41</Duration>
<MediaFiles>
<MediaFile delivery="progressive" type="application/javascript" width="224" height="398" apiFramework="VPAID">
<![CDATA[
http://localwww.viewbix.com/plugins/vpaid.js?layout=fizz&id=73272997-9d10-4c3f-973c-f573959cb47d&debug=true&html5=true
]]>
</MediaFile>
</MediaFiles>
<AdParameters>
<![CDATA[ debug=true&html5=true ]]>
</AdParameters>
</Linear>
</Creative>
</Creatives>
<Error>
<![CDATA[ https://localwww.viewbix.com/tracklog ]]>
</Error>
</InLine>
</Ad>
</VAST>
Note that there is an "AdParameters" node. According to the VAST specification, the information in this node is supposed to be passed to the initAd function in the CreativeData parameter, but in the Kaltura implementation, CreativeData contains an object with no properties.
Please note that the Google VAST Inspector page (here does pass the parameters correctly.
Has anyone been able to get this to work?
There was a bug in which AdParameters resulted empty. It should be fixed. Here's the issue if you want to fix it in your own Kaltura player. https://github.com/kaltura/mwEmbed/pull/2040
I was unable to get this to work too, though the player seems to store the AdParameters and all their code is open source on github, so you could always add a fix yourself (AdParameters are saved to 'adConf' variable in the JS). Kaltura Repo: https://github.com/kaltura/mwEmbed
Kaltura player includes Google IMA plugin too - you can use it and set as adTagURL the vast XML
I am new to flex. I have used iframe to embed html page into my flex application. Here is the following code to embed the html file :
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:flexiframe="http://code.google.com/p/flexiframe/">
<flexiframe:IFrame id="googleIFrame"
label="Google"
source="http://heatmap.html"
width="80%"
height="80%"/><mx:Application>
The challenge what I'm facing is that I want to pass parameter to html page (HeatMap.html) when loaded from iframe.
How to pass the parameters? Do I need to write separate function?
You can write a function on HTML page and call the function in html page using iFarameid.callIFrameFunction("func_Name",parameters...)
So i am using FlashDevelop and flex but i can't get the source to work correctly. When ever i Embed a image it works just fine but if i just go source="../img/Koala.jpg" same path that i used for the working embed it doesn't work. In flash builder all i would have to do is source="/img/Koala.jpg" and it work work just fine. If i type in the path "D:\flashDevelop\FlexMobileProject\src\img\Koala.jpg" this works fine. Can anyone please explain what i'm missing here?
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
title="HomeView" creationComplete="init()">
<fx:Script>
<![CDATA[
[Embed(source = "../img/Koala.jpg")]
[Bindable] public var img:Class;
public function init():void {
var s:String = new String();
label.text = String(imgstage.sourceHeight);
trace(imgstage.source);
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<!-- can't find the image even if that path is the same as the embed -->
<s:Image id="imgstage" source="../img/Koala.jpg" y="0" x="0"/>
<s:Label id="label" text="name"></s:Label>
</s:View>
When you specify 'source' for an Image, the file will be loaded at run time. However, FlashDevelop doesn't copy the files from src/ to bin/ - you must populate the bin/ directory manually with the elements you want to load at run time. Paths at run time are resolved relatively to the HTML page.
Embeds are resolved at compile time, and it should be noted that when using FlashDevelop the path is always resolved relatively to the class/mxml file and not relatively to the project root. If the path starts with "/" it will be relative to the classpath's root.
PS: these limitations are actually in the Flex SDK.
If I remember correctly the source="../img/Koala.jpg" is processed at runtime while the embed directive is processed at compile time. So the working directory is different which causes the source="" to fail.
Does the following work :
<s:Image id="imgstage" source="img/Koala.jpg" y="0" x="0"/>
Assuming the img folder is next to your swf file it should work.
In FlashDevelop, whatever files that you want to keep outside the SWF have to be placed in bin folder.
I'm doing some basic tests with the moduleloader in flex, but i cant get it to work.
What i'm doing is the following:
in my main .mxml file i added the following inside a canvas:
<mx:ModuleLoader id="tagModuleLoader" error="tagModuleLoader_errorHandler(event)" url="com/test/vincent/modules/ImageFramesModule.swf"/>
And in my module i have the following:
<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" initialize="module1_initializeHandler(event)" layout="absolute" width="400" height="300">
<mx:Script>
<![CDATA[
import mx.events.FlexEvent;
protected function module1_initializeHandler(event:FlexEvent):void
{
// TODO Auto-generated method stub
trace("inside the module");
}
]]>
</mx:Script>
<mx:Label x="163" y="139" text="image frames"/>
</mx:Module>
When i run the project i allways get the following error:
Error #2035: URL niet gevonden. URL: app:/Library/WebServer/testProject/bin-debug/com/test/vincent/modules/ImageFramesModule.swf
The module is swf file is present at that location but it still tells me that it cant be found
I do have to mention that if i run the module swf, i only get a blank blue screen, even if i add a panel or a label or whatever. I also have to mention that i'm not using the default "flex 4.5" sdk but the "extension builder 3.4" sdk.
Can anyone tell me why my swf files arent found?
Update your framework, its a bug that was patched. ;)