BTA Flexing

My passion RIAs…………..Shardul Singh Bartwal

Archive for April, 2009

Passing variable from outside into a popup window

Posted by Shardul Singh Bartwal on April 16, 2009

If we are require to pass any variable from outside into a popup window in flex,the way
is slightly different then creating Popup in a classic way.Actully its not the different
instead there is a type casting into the same class which we are going to display in popup.
Let suppose you want to pass a string value into the popup then inside the popup you need
to create a public varible, like I am creating ‘urlValue’ string type variable inside the popup.

Now pass the value inside the popup as below:-

var myPopUp:MyPopup= MyPopup(PopUpManager.createPopUp(this, MyPopup, true));

myPopUp.move(((Application.application.width/2)-(myPopUp.width/2)),((Application.application.h

eight/2)-(myPopUp.height/2)));

myPopUp.urlValue = “value from outside”;

Here the MyPopUp is the class which we are going to show in popup.

Hope it will be helpfull for you.

Advertisements

Posted in ActionScript 3.0, Flex | 1 Comment »

Managing Custom Events in Flex 3.0 in a easy way

Posted by Shardul Singh Bartwal on April 15, 2009

As all of us require Custom Events in our Flex applications. Also we know the Event Life Cycle in Flex. I am sure that all of you will be familiar with event targating,bubling,capturing etc.Also we know that we are require to remove the Listeners which we adds. We all know that inside a flex application the event first goes to the application level and then from there back to the component which have to listen it. This issue becomes more critical if we are not using any particular architecture like Pure MVC or Cairngorm etc.So in this condition first you have to dispatch a event and listen it at application level and then again dispatch a event on its occurring and listen that at the desired place. The other ways are like by using the references of the Class from where the event is dispatched and where it is being listen in each other etc.I have created a CustomEventManager Class for managing custom event dispatching, and Listening it.Its very simple to use it. It is a static class.

For dispatching event simply write like this:

CustomEventManager.dispatchEvent(new YourCustomEvent(YourCustomEvent.YOUR_CUSTOM_EVENT));

and for Listioning the custom event write like this at right place in the event Listioning
class(e.g. at creationComplete of the class or constructor etc ):

CustomEventManager.addEventListener(YourCustomEvent.YOUR_CUSTOM_EVENT,yourCustomEventHandler);

I am also adding the code of the ‘CustomEventManager’ class.Hope it will be helpful for you.

For CustomEventManager Class click here.

Posted in ActionScript 3.0, Flex 3.0 | 6 Comments »

Smoothing the Bitmap

Posted by Shardul Singh Bartwal on April 15, 2009

Normally when we are dealing with the ‘smoothing’ property of the ‘Bitmap’ class it looks that its effect is not of the major aspect.But it plays a vital role.I found a very help full link related to understanding its value.If you are not getting the quality factor on the movement(by mean of rotation,skew,scale etc) on bitmap then you should check the ‘smoothing’ property of the bitmap by tracing it whether it is true or false.The link below will clear you doubts and variations of the quality issue in Bitmap.Its value is more important if u are getting the bitmap of any Image which you are accessing through the url.
Please have a look at the link below to understand this issue and its solution.Thnx to Grant Skinner for this nice post.

The link is……….

http://www.gskinner.com/blog/archives/2007/08/minor_bug_with.html

Posted in ActionScript 3.0, Flex 3.0 | Leave a Comment »