Posted by Daniel | Posted in AIR, Development, Flex, Software | Posted on October 12, 2011
0
In the Adobe AIR application descriptor file there are many options you can set. One of which is the tag(or in Flex SDK v4.1 and below), which lets you differentiate your release as well as utilize the Adobe AIR updater library.
It can be useful to display your version number inside of your app to inform the user as well as help with bug reports among other reasons. In order to prevent you from having to update the version number in multiple places you can use AS3 to grab it from the application descriptor and update your text for your app on the fly, as it loads. Here is an example of how to do that:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
| <?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="windowedapplication1_creationCompleteHandler(event)">
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
protected function windowedapplication1_creationCompleteHandler(event:FlexEvent):void
{
var appXML:XML = flash.desktop.NativeApplication.nativeApplication.applicationDescriptor;
var ns:Namespace = appXML.namespace();
versionLabel.text = 'v' + appXML.ns::versionNumber;
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:Label id="versionLabel" />
</s:WindowedApplication> |
Flex Builder Project
Posted by Daniel | Posted in Development, Flex, Software | Posted on October 5, 2011
0
You may have noticed MouseEvent.Click is not an event available to be set on the BitmapImage Spark primitive(in the current Flex SDK). But, there is a simple workaround for this. All you have to do is place it inside of a Graphic primitive wrapper. In MXML it would look like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
| <?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">
<fx:Script>
<![CDATA[
import mx.controls.Alert;
protected function graphic1_clickHandler(event:MouseEvent):void
{
Alert.show('Nope!', 'Click Event');
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:HGroup id="container">
<s:Graphic click="graphic1_clickHandler(event)">
<s:BitmapImage source="path/to/image.jpg"
smooth="true"
smoothingQuality="high" />
</s:Graphic>
</s:HGroup>
</s:Application> |
Flex Builder Project
In AS3 it looks like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
| <?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"
creationComplete="application1_creationCompleteHandler(event)">
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.FlexEvent;
import spark.primitives.BitmapImage;
import spark.primitives.Graphic;
protected function application1_creationCompleteHandler(event:FlexEvent):void
{
var myBI:BitmapImage = new BitmapImage();
myBI.source = 'path/to/image.jpg';
myBI.smooth = true;
myBI.smoothingQuality = 'high';
var myG:Graphic = new Graphic();
myG.addElement(myBI);
myG.addEventListener(MouseEvent.CLICK, graphic1_clickHandler);
container.addElement(myG);
}
protected function graphic1_clickHandler(event:MouseEvent):void
{
Alert.show('Nope!', 'Click Event');
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:HGroup id="container">
</s:HGroup>
</s:Application> |
Flex Builder Project
Posted by Daniel | Posted in Development, Flex, Software | Posted on July 11, 2010
14
If you have run across this error recently: VerifyError: Error #1014: Class IIMEClient could not be found.
You may be wondering what it means, and more importantly how to fix it. What appears to be the sole cause of this error is your versions not matching up between your Flex/AIR SDK and the AIR application descriptor file. This can happen after you update/reinstall Flash Builder, or the SDK folder manually.
The fix is pretty easy: Just open your AIR descriptor file(generally the only XML file in the project src folder) and change the xmlns to the current version of the SDK you are using(1.5.3 => 2.0 for instance). See screenshot below for an example(warning: it’s big):
