Adword: Encountered flash error - ad cannot use mouse tracking - apache-flex

Trying to create a banner ad as a one-off project for a client. I am using Flash Builder / AS 3 and with my simple hello world example. Google Adwords rejects the add with: Encountered flash error - ad cannot use mouse tracking.
I Have not been able to figure out what I am doing that signals to Adwords that I am mouse tracking. Follows is my simple mxml file: (the handleClick is to adhear to their clickTAG specification)
Thanks!!!
<?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="336" minHeight="280" width="336" height="280" includeInLayout="true" click="handleClick(event)">
<fx:Script>
<![CDATA[
public function handleClick(mouseEvent:MouseEvent):void {
navigateToURL(new URLRequest(root.loaderInfo.parameters.clickTAG),"_blank");
}
]]>
</fx:Script>
</s:Application>

It is quite possible that whatever automated analysis that Google does on the ads submitted is being confused by the Flex framework. You could try creating an ActionScript project instead of Flex project in Flash builder and see if that makes any difference.
If you use an ActionScript project you won't be able to use MXML for creating the ad, but you might not really even want to drag in the Flex framework, since it takes a while to load (the first time at least).

Related

Print through flex / flash builder mobile application for ios

I have to allow user to print through my application. I am creating application for ios using flash builder 4.5.1
Here is the code for it:-
<?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">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.printing.*;
// Create a PrintJob instance.
private function doPrint():void
{
// Create an instance of the FlexPrintJob class.
var printJob = new FlexPrintJob(); // calls the dialog
if(printJob.start()) // Starts when the user presses ok
{
printJob.addObject(dashPreview,FlexPrintJobScaleType.MATCH_WIDTH); // the object you want to add, and the scaling you want to apply
printJob.send(); // Send everything to the printers.
}
}
]]>
</fx:Script>
<s:Label id="dashPreview" x="334" y="110" text="naveed mansuri">
</s:Label>
<s:Button id="myButton" x="19" y="215" width="729" label="Print" click="doPrint();">
</s:Button>
</s:View>
But Whan I run this application and clicl on print, I got following error box of errors:-
Error: Error #2055: The print job could not be started. at Error$/throwError()
at flash.printing::PrintJob/start()
at mx.printing::FlexPrintJob/start()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\printing\FlexPrintJob.as:200]
at views::PrintHomeView/doPrint()[C:\Documents and Settings\naveedmansuri\Adobe Flash Builder 4.5\Print\src\views\PrintHomeView.mxml:20]
at views::PrintHomeView/__myButton_click()[C:\Documents and Settings\naveedmansuri\Adobe Flash Builder 4.5\Print\src\views\PrintHomeView.mxml:34]
What wrong in this code? Is print class is not mobile optimized?
I have to print only a label text.
Sincere request to get me out of this issue. I have a release date soon for this application.
From the LiveDocs:
Mobile Browser Support: This class is not supported in mobile
browsers.
AIR profile support: This feature is supported on all desktop
operating systems, but it is not supported on mobile devices or AIR
for TV devices. You can test for support at run time using the
PrintJob.isSupported property. See AIR Profile Support for more
information regarding API support across multiple profiles.
Only way to print on mobile devices is through an AIR Native Extension.

Make Flex mobile full screen in desktop (as an air app)

I need to make flex mobile application to be full screen when it runs on desktop OSs (I've packaged it as an air app)
I'm pretty sure that your view will dispatch it's creationComplete event before the main Application is added to the stage, which is probably why you got the error.
In the past, I've used the applicationComplete event and the StageDisplayState.FULL_SCREEN. Here is an old blog post I wrote about it.
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" alwaysInFront="true"
applicationComplete="onApplicationComplete()">
<mx:Script><![CDATA[
public function onApplicationComplete():void{
this.stage.displayState = StageDisplayState.FULL_SCREEN;
}
]]></mx:Script>
</mx:WindowedApplication>
I see no reason why this code wouldn't work in a Flex 4 / Spark app.
Switching to full screen through stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE can not be done on a creation complete handler. It must be done through user interaction. I actually just did this yesterday. Add a button to your app and set the onClick to a function that sets full screen and hides the button. That's how I did it anyways.

flex browser application initialization

Would anyone be able to point out some good tutorials on creating applications in flex that are don't have UI's?
Actually, it looks like all I really need to know is how to call a function upon initialization of the flash object. I tried the creationComplete attribute, but it doesn't work in browser.
Well, I'm not sure what made it work finally, but I ended up copying and pasting this code from some website (sorry, i don't remember the site):
<?xml version="1.0" encoding="utf-8"?>
<!-- wrapper/CheckExternalInterface.mxml -->
<s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
creationComplete="initApp()">
</s:Application>
And that ended up working! thanks anyway.
If you're intent is to connect JavaScript to a Java Server, why not use XMLHTTPRequest? IT is the basis of every AJAX style RIA application. The data format you pass back and forth can either be JSON or XML. It doesn't have to be binary.
Second, you don't need Flex for this. The Sockets APIs in ActionScript and are part of the Flash Player. You can use them without any dependencies to the Flex Framework.

adobe flash buider (flex4): Error #2025 or Error: addChild() is not available in this class. Instead, use addElement()

I'm a complete newbie to Flex, so apologies for my dumbness. I've searched for an answer but haven't found anything that seems to be doing the trick.
What I'm trying to do: port this example http://www.adobe.com/devnet/air/flex/articles/flex_air_codebase_print.html
to Flash Builder 4.
All seems to be fine but for one thing. When I use the original code for the Air application
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
creationComplete="onApplicationComplete()">
<fx:Script>
<![CDATA[
private static const neededForCompilation:AirGeneralImplementation = null;
private function onApplicationComplete():void
{
var can:MainCanvas = new MainCanvas();
this.addChild(can);
can.labelMessage = "Loaded in an AIR Application ";
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
</s:WindowedApplication>
I get this run time error
Error: addChild() is not available in
this class. Instead, use addElement()
or modify the skin, if you have one.
at
spark.components.supportClasses::SkinnableComponent/addChild()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:1038]
If I substitute the code with
this.addElement(can);
Everything loads well but the first time I try to press any of the buttons on the main canvas I get the following run time error
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/getChildIndex()
at mx.managers::SystemManager/getChildIndex()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:1665]
at mx.managers.systemClasses::ActiveWindowManager/mouseDownHandler()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\systemClasses\ActiveWindowManager.as:437]
here's the super simple code for the main canvas
<?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="955" minHeight="600"
creationComplete="init();">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script source="main.as" />
<mx:Label id="lblMessage" text="The UI from the shared Flex app BothCode" x="433" y="112"/>
<s:Button x="433" y="141" click="saveFile();" label="Save File"/>
<s:Button x="601" y="141" click="GeneralFactory.getGeneralInstance().airOnlyFunctionality();" label="Air Only"/>
</s:Application>
Any help would be immensely appreciated. And any pointers to how to setup a project that can compile in both Air and Flash while sharing the same code, all for Flex 4, would also be immensely appreciated.
thank you!
I ran into the same problem using that tutorial for Flex 4. I did the same thing as you and used the <s:Application> component for the Main Canvas. However the tutorial uses a <mx:VBox>, the solution I found was to change the Main Canvas from an <s:Application> to an <s:Group>. The problem seems to be embedding an Application within an Application.
The code on that link was written using the flex 3.5 sdk or below. You are using the new flex 4 sdk ( which is the default for Flash Builder ).
You can do the following:
1. step into the code do any necessary changes to make it work for flex 4 sdk.
2. setup a new project using the flex 3 sdk ( select "Use a specific SDK" and choose the Flex 3 from the dropdown box in the "New Project" window)
I would suggest going for the second option, make it work and once you've stepped a little deeper into flex 4 you can do the 1st option.
Cheers.

Unable to display Google Map through API in Flex SDK

I am using the mxmlc to compile the examples from google to get started in using Google Maps API in Flex 4. But after compiling the swf file the map does not load.
I've registered for an API key
Downloaded and included the Maps SDK in the xml config file used at compile time
C:\sdk\flex4\frameworks\flex-config.xml
<external-library-path>
<path-element>libs/google/maps/lib/map_flex_1_18.swc</path-element>
</external-library-path>
Foo.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<maps:Map xmlns:maps="com.google.maps.*" id="map" mapevent_mapready="onMapReady(event)"
width="100%" height="100%" key="{KEY}"/>
<mx:Script>
<![CDATA[
import com.google.maps.LatLng;
import com.google.maps.Map;
import com.google.maps.MapEvent;
import com.google.maps.MapType;
private function onMapReady(event:Event):void {
this.map.setCenter(new LatLng(40.736072,-73.992062), 14, MapType.NORMAL_MAP_TYPE);
}
]]>
</mx:Script>
</mx:Application>
Any tips on where to go from here? I can compile a basic flex project without problem and displays the components I put in so i'd imagine it's something to do with the API Key?
Thanks for the help
If your onMapReady function is getting called your api key is probably ok (you would get an error otherwise)
I had the exact same problem. But adding the following to the onMapReady() function seemed to fix it:
private function onMapReady(event:Event):void
{
map.enableScrollWheelZoom();
map.enableContinuousZoom();
map.addControl(new ZoomControl());
this.map.setCenter(new LatLng(40.736072,-73.992062), 14, MapType.NORMAL_MAP_TYPE);
}
You should also consider using the latest version of the library it is now on version 20
Unfortunately, google does not yet "officially" support Flex 4 so I imagine there might be other bugs out there as well.
Note if you happen to be using https you also need to add a call to Security.allowInsecureDomain("maps.googleapis.com");

Resources