Archive for September, 2010

Unique Random Generator

The following code generates the unique random numbers.
User will input max length (for ex: 10 unique random numbers from 0 to 10) in textinput , and on keyup event values are populated in text area one below another.

<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml&#8221; layout=”vertical” width=”100%” height=”100%”
backgroundAlpha=”1″ backgroundGradientAlphas=”[1,1]” backgroundGradientColors=”[#999999,#999999]”>
<mx:Script>
<![CDATA[
import mx.utils.ObjectUtil;
private function calUniqueRandomNo(maxCount:Number):void
{
resText.text = “”;
var resArr:Array = new Array();

while(resArr.length<maxCount)
{
var randNo:int = parseInt((Math.random()*maxCount).toString()) ;
if(!search(randNo,resArr))
{
resArr.push(randNo);
}
}

resText.text += resArr.toString();
}

private function search(valueToSearch:int,arrayToSearch:Array):Boolean
{
for(var j:int=0;j<arrayToSearch.length;j++)
{
if(arrayToSearch[j]== valueToSearch)
{
return true;
}
}
return false;
}
]]>
</mx:Script>
<mx:FormItem label=”Count:”>

<mx:TextInput id=”maxCountIp” keyUp=”{calUniqueRandomNo(Number(maxCountIp.text))}” />

</mx:FormItem>
<mx:TextArea id=”resText” width=”70″ height=”70%”/>
</mx:Application>

If any other way , welcome to post as comment.

 

Advertisements

Leave a comment

Popup Anchor control Flex 4

The PopUpAnchor control is part of the Spark component set and available only in Flex4

The PopUpAnchor control displays a pop-up component in a layout. The PopUpAnchor displays the pop-up component by adding it to the PopUpManager, and then sizes and positions the pop-up component relative to itself. Because the pop-up component is managed by the PopUpManager, it appears above all other controls.

With the PopUpAnchor control, you can create various kinds of popup functionality, such as the following:

Click a button or a hyperlink, and a form to submit feedback pops up
Click a button, and a search field pops up
These first two scenarios each contain three controls: the button or hyperlink control, the PopUpAnchor control, and the component that pops up (the form or search field).
Mouse over the top of an application and a menu drops downIn a calendar tool, double-click an appointment block to open an Edit dialoge

Find out the more detailed explanation here

Leave a comment

WHAT IS CONFIDENCE AND DEDICATION?

Have a look on the real incident.

India vs Australia [2004] match…

Brad Hogg took Sachin’s wicket.

cid:image001.jpg@01CAEAE2.ED92CD90cid:image002.jpg@01CAEAE2.ED92CD90

At the end of the match Hogg gave that

Ball to Sachin for his autograph.

Sachin put his sign with one beautiful sentence,

“IT WILL NEVER HAPPEN AGAIN.” –

cid:image003.jpg@01CAEAE2.ED92CD90

 

 

 

Till today Hogg could not take his wicket for the second time.

 

THAT’S CONFIDENCE & DEDICATION..!

HATS OFF TO OUR LITTLE MASTER SACHIN.

 

After this incident Brad Hogg and Sachin Tendulkar came face to face 21 times…but he could never get the Master Blaster out 🙂

Howzaaat!

cid:image005.jpg@01CAEAE2.ED92CD90cid:image006.jpg@01CAEAE2.ED92CD90cid:image007.jpg@01CAEAE2.ED92CD90

Live  your life with such confidence and dedication . Have a Great Life always.

 

Leave a 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

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

Solution:
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: http://www.negush.net/blog/5005-unknown-error-optimizing-byte-code/

1 Comment