Archive for category Flex_Training

Flex : Find the URL of the Server / Local file location based on the Application server type

This code is used to find the URL of the Server / Local file location based on the Application server type (java, php,.. / none).

– by Abdul


Leave a comment

Alert control with long text in single line

alert =“Terms and Conditions Agreement”,”,Alert.YES | Alert.NO,this,function(){},null,Alert.YES);

alert.mx_internal::alertForm.mx_internal::textField.mouseEnabled = false;

alert.mx_internal::alertForm.mx_internal::textField.htmlText = “asdjflasdjfklasjdlfkjasdklfjal5rt34523452345234asdjflasdjfklasjdlfkjasdklfjal5rt34523452345234asdjflasdjfklasjdlfkjasdklfjal5rt34523452345234asdjflasdjfklasjdlfkjasdklfjal5rt34523452345234asdjflasdjfklasjdlfkjasdklfjal5rt34523452345234”;

alert.mx_internal::alertForm.mx_internal::textField.autoSize = TextFieldAutoSize.CENTER  ;

alert.mx_internal::alertForm.mx_internal::textField.wordWrap = false ;

1 Comment

Cannot debug this SWF because it does not contain ActionScript

Dhiraj Said :

In my project I was facing a problem in Flash. In which it seems that the code was not executing, I can’t even trace anything written in constructor of my document class, And when I had tried to debug the same I got the alert message saying
“You cannot debug this SWF because it does not contain ActionScript.”.

I have found a solution for this

“You cannot debug this SWF because it does not contain ActionScript”.
Unable to compile the source code.

This was due to the large size of the source code. The document class consists about more than 16 thousand line.
Because of this the compiler was unable to compile the code.

Here all we have to do is increase the heap memory size of JVM used by flash to compile SWFs.

Here is the way:
Go to
My Computer > Advance system setting >  Environment variable

In the system variable

1. Add  JAVA_TOOL_OPTIONS and its value as –Xmx512M

Here are the other value (–Xmx128M, –Xmx256M, etc)

Do not set to  –Xmx1024M or that will again cause another error of JRE.

2. File >> Save and Compact
3. Delete ASO file from control menu
4. Close Flash,
5. Open Flash.

This solved my problem… ?

Reference Link:

1 Comment

Flex Builder Key Assist

Use following key shortcuts, as they help in faster code development
1) select the code line or lines, then Ctrl + Alt + Up Arrow Key or Ctrl + Alt + Down Arrow Key
— copy the selected line or lines of code on upside/downside of the selected line or lines

2) Ctrl + O
— opens the window with all variables , functions and controls in current .mxml or .as file

3) Ctrl + Shift +R
— opens the window with list of all files of all open projects in the workspace of Flex builder
— very useful if you remember the filename of the file which  you want to open.

4) Ctrl + Shift +F
— opens the search window and search throught files of all open projects in the workspace of Flex builder

Enjoy great coding of Flex !!I will post some more in future. You can also find key assist in Flex builder by Ctrl+Shift+L.

Leave a comment

isPopUp property for PopUpManager in Adobe Flex

1) I created the popup window of  treatmentPlan :

var treatPlanPopup:treatmentPlan ;

treatPlanPopup = PopUpManager.createPopUp(Application.application as DisplayObject, treatmentPlan,true) as treatmentPlan;
treatPlanPopup.isPopUp = true;

2) isPopUp property can be used in 2 ways:

  1. Prevent creation of multiple window of treatmentPlan by PopUpManager by setting the isPopUp property to true and check the value again on next creation
  • on creation of popup window object  treatPlanPopup is created and on close it does not get null value , but isPopUp value becomes false.
  • Till window is not closed , isPopUp value remains true
  • So next time before opening the treatmentPlan window by PopUpManager, if you check the value treatmentPlan.isPopUp, it comes false
  • if(treatPlanPopup !=null && treatPlanPopup.isPopUp)
    {return}//do not open the popup window
  • *********************************************************
  • Create an undraggable TitleWindow container by setting the isPpUp property to false on the TitleWindow instance.
  • Example on

1 Comment

Find criteria must contain at least one sort field value

1) I applied the sorting to arraycollection :

var sf:SortField = new SortField(); = “CaseID”;
var srt:Sort = new Sort()
srt.fields = [sf];
cases.sort = srt; // cases is arraycollection and storing values //from backend service

But it cause the execption stating “Find criteria must contain at least one sort field value”, on checking the dataprovider we found that field ‘CaseID’ was not present in data but ‘CaseId’ and because of that it was causing the exception.

So make sure that the sortfield should present in the data.

Leave a comment

Alert Box customization

1) Prevent scroll of alert message in case of more text

import mx.controls.Alert;
use namespace mx_internal;
private var alert:Alert;

private function preventAlertContentScroll():void
alert =‘Long alert message causing scroll in text on mousewheel and I want to prevent that. ‘);
alert.mx_internal::alertForm.mx_internal::textField.mouseEnabled = false;

2) Styling of Alert Text

In Style Tag , define class based style and for specific style to the text content use messageStyleName.

– Alert
messageStyleName: “alertMessage”;

letterSpacing: 0;
fontSize: 10;
fontWeight: normal;
color: black;

There are some more styles related to the Alert control.

Leave a comment