FAQ

Questions:

  1. How do I separate a double click from a single click in Flex3?
  2. How do I copy a workspace from one disc location to another?
  3. How do I upgrade the Flex SDK in Flex Builder?
  4. Why does my <mx:repaeter/> use up so much memory?
  5. What’s the difference between a Flex 4 elements and children?
  6. How do I add new lines in the text objects in Flex 4?
  7. How do I use a debugger with Flex 4?
  8. What sort of shortcut keys can I use in FB4?
  9. Why can’t Flashbuilder create a java machine?

 

Answers:

1.  How do I separate a double click from a single click in Flex3?

// MESSY, BUT IT WORKS. by Fraser Halley  :-)

import flash.utils.Timer;

private var doubleClickDispatched:Boolean = false;

 

// REF THIS FUNCTION IN THE COMPONENT ‘DOUBLE CLICK’ / ‘ITEMDOUBLECLICK’ PROPERTY private function myDoubleClickFunction():void {

// INDICATE THIS IS A DOUBLE CLICK

doubleClickDispatched = true;

 

// NOW DO THE REAL ‘DOUBLE CLICK’ CODE

// …

}

// REF THIS FUNCTION IN THE COMPONENT ‘CLICK’ / ‘ITEMCLICK’ PROPERTY private function preSingleClickFunction():void {

// WAIT 0.5 SECS – THE DEFAULT DOUBLE CLICK SPEED IN WINDOWS XP

var shortWait:Timer = new Timer(500, 1);

shortWait.addEventListener(TimerEvent.TIMER_COMPLETE, mySingleClickFunction);

shortWait.start();

}

private function mySingleClickFunction(e:Event):void {

// CHECK IF A DOUBLE CLICK WAS DISPATCHED

if (doubleClickDispatched) {

doubleClickDispatched = false;

return; // DON’T DO THE SINGLE CLICK CODE

}

 

// NOW DO THE REAL ‘SINGLE CLICK’ CODE

}

 

 

 

2. How do I copy a workspace from one disc location to another?

There is no really easy way to do this. the safest (and rather tedious way) is to create the new workspace and then import the project folders one at a time. But also see Flex Builder 3 Tip: Migrating a Workspace

 

3. How do I upgrade the Flex SDK in Flex Builder?

  • Download the appropriate zip file from Adobe’s website
  • Unzip, rename the directory appropriately (e.g. 3.4.0) and move into the sdk directory (mine is C:\Program Files\Adobe\Flex Builder 3\sdks).
  • In FlexBuilder use preferences > Flex > Installed Fex SDKs > Add to add your new SDK directory.
  • Set to be default SDK if required (note that you can override the default SDK for a particular project by using Project > Properties > Flex compiler Use a specific SDK.
  • For more information see nwebb.co.uk “Upgrading SDK when using Flex Builder”

 

4. Why does my <mx:Repeater/> use up so much memory?

Just found one reason why my app was eating so much memory, when adding a repeater that is big you need to add recycleChildren as true (default is false). e.g.:

<mx:Repeater dataProvider=”{imageArray_ID}” recycleChildren=”true”>

Otherwise all the objects in the repeater are recreated when you change the dataprovider, this is crucial if you are loading multiple object one after the other as the garbage collector is not called until all the objects are loaded. (also sometimes memory is leaked so you can’t get the memory back).

More info here:

http://www.adobe.com/devnet/flex/articles/client_perf_10.html

Stefano.

 

5. What’s the difference between a Flex 4 elements and children?

See Bill White’s blog at http://www.billdwhite.com/wordpress/?p=296

 

6. How do I add new lines in the text or the textArea objects in Flex 4 (spark)?

From: Padilla, Stefano [mailto:S.Padilla@hw.ac.uk]
Sent: 10 August 2010 13:25 

I been struggling to find how to add new lines in the text or the textArea objects in Flex 4 (spark).Hopefully you won’t waste time by using the code below:

<s:TextArea fontSize=”10″ fontFamily=”Verdana”  textAlign=”left”>

<s:content>

<s:p>1. First Line.</s:p>

<s:p>2. Second Line </s:p>

</s:content>

</s:TextArea>

All the old methods like having \n, \\n, {‘\n’}, do not work anymore plus there is no htmlText in the spark components.

Also if you use mx:text and htmlText with the halo theme (spark) then html is not rendered correctly.

 

 

 

 

7. How do I use a debugger with Flex 4?

I’ve just installed (16/7/2010) FB4 and had a struggle with the debugger versions of the Flash player 10.1. I still have FB3 installed – so this may have caused some of the problems.

I used the Flash players ailable from http://www.adobe.com/support/flashplayer/downloads.html).

I scrolled down to “Adobe Flash Player 10.1 � Debugger” and tried to install the IE version – no luck. I also installed the Netscape version seemingly ok, but it doesn’t seem to work in debug mode. I down loaded the stand alone version (‘projector’ version) and copied on top of the version 9 player. (FB4 wanted to use the version in C:\Program Files\Adobe\Flex Builder 3\Player\win – so I copied it in here).

Note that you have to untick the “Generate HTML wrapper file” to use the stand alone player. (Go to Project > Properties > Flex Compiler in FB4 to do this).

8. What sort of shortcut keys can I use in FB4?

See Flash Builder 4 Shortcuts and Tips Flash Builder Shortcuts and Tip

9. Why can’t Flashbuilder create a java machine?

It’s because either you don’t have java installed (e.g. from http://www.oracle.com/technetwork/java/javase/downloads/jdk7u7-downloads-1836413.html)

Or because you don’t have your system path environment virable setup to point to the jre executable.

To inspect path type windows-key+r, cmd (to get command line window) and type ‘set path’.

It should have something like C:\Program Files\Java\jre7\bin; in it (for the 64bit version)

 

 

 

Comments are closed.