Flex Canvas bug when it is zoomed in and “horizontalCenter = 0”

Recently I came across a Flex source url bug when working on canvas. If you have a canvas with an object centered inside ( horizontal or vertical, it’s the same ) and scale this object the result is that the canvas will clip left and top its contents!
To understand what I mean see this example and try to scale the image:

Get Adobe Flash player

And this is the code used:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
< ?xml version="1.0" encoding="utf-8"?>
<mx:application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundAlpha="0">
   <mx:number id="scale">1</mx:number>
   <mx:vbox horizontalCenter="0" verticalCenter="0">
      <mx:hbox width="100%" horizontalCenter="0">
         <mx:label text="Zoom" /><mx:hslider value="{scale}" change="{scale = HSlider(event.target).value}" width="100%" />
      </mx:hbox>
      <mx:canvas width="200" height="200"
               backgroundColor="#EEEEEE" borderColor="#666666"
               borderStyle="solid" verticalCenter="0" horizontalCenter="0" >
         <mx:image id="image" source="@Embed('../assets/test.png')" scaleX="{scale}" scaleY="{scale}"
                 verticalCenter="0" horizontalCenter="0" />
      </mx:canvas>
   </mx:vbox>
</mx:application>

As you can see once the image is scaled and it’s bigger that its parent, you wont be able to see it top left corner anymore. This is an annoying bug for me!

Later I found that someone opened a ticket in the Flex bug management system here: http://bugs.adobe.com/jira/browse/SDK-13009
A couple of days ago I received a notification that the bug has been closed… and incredible they closed it as NOT A BUG!
I can understand that finding the bug in a file with 5000 and more lines of code it’s not easy and can cause horrible headache, but the reason they gave it’s nosense! It’s completely a different thing that the reason of this bug.

Moreover what’s the connection between flash and html?

Flex have been designed since the 1.0 version as a framework for building RIA (Rich Internet Applications).
A RIA have to behave as a desktop application that runs using the web browser. One of the advantages of Flex agains Ajax is that the first technology provide to the user a behaviour which is much more similar to desktop applications that the one provided using HTML+Javascript. And so my questions is: why should Flex behave like HTML when one of its most important features is to be different from HTML ?
Flex behaves like other SDKs used to develop desktop apps in many situations which are much less important than the one hilighted above. So why close this bug (yes. it is a bug) providing as explanation that it is correct because it behaves like HTML ?

Flex Frameworks

Luke Bayes and Ali Mills of PatternPark made a presentation for the Silicon Valley Flex Users Group (SilvaFUG) of 9 different frameworks and toolkits for creating Flex applications: Cairngorm, PureMVC, ARP, MVCS, Flest, Model-Glue: Flex, ServerBox Foundry, Guasax, and Slide.

Watch the presentation: http://adobechats.adobe.acrobat.com/p12266504/
See the slides: http://www.asserttrue.com/files/ApplicationFrameworks/index.html

http://sayitaduran.com/biology-unit-5-synoptic-essay-help/ Their Conclusion? essay on university life
PureMVC by Cliff Hall beats out the alternatives
“.

  • Composition over inheritence
  • Liberal use of Interfaces
  • Indirection is used but not overwhelming
  • Instance members hide singleton references from application code
  • MXML views can be extremely thin
  • Benefits of Cairngorm, with few of the disadvantages.

I must admit I never used PureMVC, the only framework I’m currently using is Cairngorm, even if I bookmarked the pureMVC page long time ago promising myself to watch it more in deep. Now it’s time to keep the promise.

Flex 2.0.1 SDK Hotfix 1 (bug fix)

Adobe just released an update for Flex 2.0.1 SDK, download it from http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=kb401224

Flex 2.0.1 SDK hotfix 1 (build 159086) is a collection of bug fixes that have been completed since the Flex 2.0.1 release on January 5, 2007. This hotfix release is being made available to Flex customers who are experiencing any of the issues described in this document and require the provided bug fixes. Installation of this hotfix release is not recommended for customers who are not experiencing one of the described issues.

Cell Renderers
192854 itemEditors on DataGrid don’t correctly commit data when dragEnable=true
192558 Combo renderer in a DataGrid causes problems on the DataGrid scroll
DataGrid
193316 DataGrid with headerRenderer and selectedIndices becomes uneditable
194284 DataGrid incorrectly focuses hScrollbar
194311 After clearing data from DataGrid, RTE occurs
183325 When set verticalScrollPolicy=”off” in datagrid, can’t move up/down to show more rows
192117 DataGrid whose width depends on the size change of Browser gets RTE
196149 DataGrid with lockedColumnCount incorrectly displays using vScrollbar
193106 Horizontal scrolling DataGrid cannot display the updated width
194972 DataGridColumn visibility=false doesn’t work (when set in mxml)
192466 The width of the last 2 columns is displayed narrower after horizontal scrolling
193641 If you resize the player window with a DataGrid with width=100%, the DataGrid’s last column continues to grow rather than showing more columns
192695 After horizontal scrolling, changing the width of DG updates the width of incorrect column
192694 Changing the width of DataGrid that is disappeared gets error (RTE)
192728 Using an itemRenderer as an editor may not update the dataProvider
195589 DataGrid with horizontalScrollPolicy cell and width behavior changed
193319 Change event doesn’t occur when moving the line using Enter and Tab key on DataGrid
195389 Tab key is functional even if scrollbar is focused
Debugging (Macintosh only)
193086 Once RTE is thrown and debug session is selected to be terminated, closing browser window does not let FB release debug session
Other
193354 CollectionChangeEventKind in CollectEvent.COLLECTION_CHANGE incorrect
192765 If you use MenuBar.dataDescriptor.setEnabled(…) on a top level item of a MenuBar, the item is not changed
126610 Binding to a static variable gives warning Unable to detect changes to ‘var’ and does not show changes
193102 Parent window becomes available after close grandchild Popup
194872 Update PhotoViewer sample README.html file with the additional compiler arguments needed to compile
Tree
192365 Selecting a node then collapsing its grandparent doesn’t move selection up to the grandparent
192347 RTE when tweening occurred while opening nodes in Tree (in Flex Explorer sample)

BTW, it seems they haven’t fixed the Nullpointer exception caused by invalid xmllists..

mxmlc NullPointerException crash

Today I was getting crazy to find out why Flex didn’t want to compile my application.. Clicking on compile it started suddenly to give me an internal compile error and nothing else. So i tried to compile with the mxmlc from a console just to see the error log and the outpuw was:

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
java.lang.NullPointerException
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:891)
at macromedia.asc.parser.BinaryExpressionNode.evaluate(BinaryExpressionNode.java:38)
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:890)
at macromedia.asc.parser.BinaryExpressionNode.evaluate(BinaryExpressionNode.java:38)
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:891)
at macromedia.asc.parser.BinaryExpressionNode.evaluate(BinaryExpressionNode.java:38)
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:890)
at macromedia.asc.parser.BinaryExpressionNode.evaluate(BinaryExpressionNode.java:38)
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:962)
at macromedia.asc.parser.ListNode.evaluate(ListNode.java:27)
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:5859)
at macromedia.asc.parser.LiteralXMLNode.evaluate(LiteralXMLNode.java:28)
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:3087)
at macromedia.asc.parser.VariableBindingNode.evaluate(VariableBindingNode.java:48)
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:962)
at macromedia.asc.parser.ListNode.evaluate(ListNode.java:27)
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:2897)
at macromedia.asc.parser.VariableDefinitionNode.evaluate(VariableDefinitionNode.java:32)
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:4629)
at macromedia.asc.parser.ClassDefinitionNode.evaluate(ClassDefinitionNode.java:86)
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:938)
at macromedia.asc.parser.ArgumentListNode.evaluate(ArgumentListNode.java:28)
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:750)
at macromedia.asc.parser.SetExpressionNode.evaluate(SetExpressionNode.java:39)
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:580)
at macromedia.asc.parser.MemberExpressionNode.evaluate(MemberExpressionNode.java:31)
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:1273)
at macromedia.asc.parser.ExpressionStatementNode.evaluate(ExpressionStatementNode.java:33)
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:4407)
at macromedia.asc.parser.ClassDefinitionNode.evaluate(ClassDefinitionNode.java:86)
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:2577)
at macromedia.asc.parser.ProgramNode.evaluate(ProgramNode.java:63)
at flex2.compiler.as3.Compiler.analyze2(Compiler.java:436)
at flex2.compiler.mxml.InterfaceCompiler.analyze2(InterfaceCompiler.java:337)
at flex2.compiler.mxml.Compiler.analyze2(Compiler.java:130)
at flex2.compiler.API.analyze(API.java:2360)
at flex2.compiler.API.analyze(API.java:2275)
at flex2.compiler.API.batch2(API.java:337)
at flex2.compiler.API.batch(API.java:1025)
at flex2.compiler.API.compile(API.java:1211)
at flex2.compiler.API.compile(API.java:1114)
at flex2.tools.Compiler.main(Compiler.java:222)

Wow!!
So, how can I find the problem? I can’t find any useful information from this log..
For this reason I had to remove portion of code from my mxml and from all the imported packages.. 2 hours of “debugging” gave me the solution!

A syntax error in a declaration of an XMLList was the problem!  Fixed the line also the compiler started to run again with no problems.

This is a portion of mxml code to reproduce the problem:

1
2
3
4
5
6
7
8
9
10
11
;


< ![CDATA[
private var uuid:String = "";
private var menubarXML:XMLList =
<>
<menuitem data=uuid>
</menuitem>
<>;
]]>

Flex 2.0.1 is here..

Adobe is just announcing the release of Flex 2.0.1 and everyone around here seems really excited about that! (I agree, Flex is really an impressive software)

Other than including the already released asdoc tool into the installer, this new release can now manage http://www.3pgroup.it/?doctoral-dissertation-help-economics CSS at runtime, support the FlashType encoding (so useful in Flash 8) and includes the  new mx.modules (for the list of complete changes and fixes I suggest to read the release notes).
Moreover it seems that this new release is ready for Apollo (when it finally will be available)..
But the big news is the Mac OSX support for Flex2.

So, now I should ask: “where is the http://profisvet.com/assign-resources/ Linux support”?
Eclipse is cross-platform, Flex is based on eclipse (1+1?)… we’ve Flex on both Windows and OS(ni)X, We already have the flash9 player for linux (I tested it on my ubuntu and seems to quite stable and faster enough).. so will we get a chance?

P.S. Here you can read the official Flex 2.0.1 release notes.

Flex Cookbook

It’s online the Flex cookbook beta in the Adobe Developer Center.
I’m a big fan of the cookbooks since I first bought the PHP cookbook and later Python cookbook. It’s probably the most simple way to learn with real examples of common problems.

As written in the Flex cookbok beta site, the in the Flex cookbook you can:
– Find solutions to your Flex-related problems.
– Publish solutions you have created for the greater Flex community.
– Comment on solutions created by others.
– Opt for a chance to have your solution published by O’Reilly.

I hope it will grow up with more and more contents!

AMFPHP 1.9 changes and future plans

Recently Patrick released a new testing version of AMFPHP which supports the Flex2 AMF3 object encoding.

Some changes:

$this->methodTable is DEAD. All methods in /services are now considered remotely accessible, unless you set them to protected or private (PHP5) or start the method name with an (_)
– Returning a mysql_query will now return either an Array or an ArrayCollection depending on the setting in gateway.php
– browser now brings up the brand spanking new Flex 2-based service browser

This is a testing version since it has still a lot of limitations and it has been tested only on PHP5. I see the post today and I haven’t tested yet…
You can read here for a detailed list of changes

Moreover Patrick plans to add to amfphp the Flex Data Services (read what they are). In this post he got a brief explanation about flash player/FDS communication and ask for developers to help him with the developement of FDS in amfphp (you might need a copy of charles).