Saturday, May 29, 2010

R u really unhappy???

Hi guys,

There may be lot of problems in front of you and may be you are not satisfied with life.

So there is a story of Bad Lucky Man, i heard years ago still remembering..

So,
There is a Man who has very bad luck, very bad means Whatever he going to do, he got failure, in Business, Study, Exams, Marrage in everything.

At last he tired to try for success..........

He decided.. to suicide. He is not interested in life any more, where failure is waiting at each step.

He planned. Taken Gun, poison, and rope.

He went to Sea side.
On a Coconut tree he hang himself by rope ....
Drink Poison,
Shoot himself by Gun.........

.
.
.
.
.
What do you think how he dead.....?


During suicide when he shoot by GUN, Bullet cut rope and he felt in sea, but
he don't know swimming , so Drowning.

Same time some fisher saw him.
save him from Drowning.
When they push his chest for breathing, along with water , poison came out.
?
?
?
?
?

Finally he didn't get success in suicide.

How unlucky he is?

When i get depressed by failure , i think i am lucky than that Bad Lucky Man.

What do you think?


Edit (05 July 2013):
Couple of years ago, I had started this blog, I wish I could write a Story for my blog (as I had some experience of some stories for local newspaper).
The above Story truly gave me +ve feedback to face the bad time, so I added this to my blog, by keeping in mind that if anybody reads the story will also get the +ve feedback. I know there are grammatical mistakes in above Story but these issues are defaults for a beginner guy who is not from English Medium. In past days, some of my friends makes joke on these grammatical mistakes and they didn’t looked out the meaning of the story. Now I can re-correct these grammatical mistakes but decided to left as it is. So that now or in future whenever I look out these mistakes I realize that I need to improve myself a bit more. I thanks to person "A", who thought this story is joke and gave me a reason to improve myself :)

Sunday, May 9, 2010

Load and Control .swf files

In this post we will see how to load swf, how to control content in loaded swf and how to access it's variables.

To load swf simply we use loader and we will add event listener to load swf contents as:
Consider master.fla has following code:

var URLReq:URLRequest=new URLRequest("slave.swf")
var loader:Loader=new Loader();
loader.load(URLReq);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,LoadComplete);
var LoadedSWF;
function LoadComplete(e:Event):void
{
LoadedSWF=e.target.content;
addChild(LoadedSWF)
// You can access any Object in
LoadedSWF by using simply (.) dot operator.
//Example if LoadedSWF contain MovieClip named myMc, then you can access it as LoadedSWF.myMc
//You can  change properties of that MovieClip as LoadedSWF.myMc.x=100
}

var masterText:TextField = new TextField();
masterText.background = true;
masterText.autoSize = TextFieldAutoSize.LEFT;
addChild(masterText);

Send_btn.addEventListener(MouseEvent.CLICK,Send_btn_Clk)
function Send_btn_Clk(e:MouseEvent):void
{
LoadedSWF.SlaveText.text=masterText.text;
}



Here in,
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,LoadComplete);

EventListener is added to what loader loads i.e. what content loader is going to load, not to the loader.
So that we get how much bytes content loader loaded in progressEvent.

We assign loaded content to variable name LoadedSWF.
First trace(LoadedSWF) outputs undefined.
and second trace(LoadedSWF) it shows [object MovieClip] i.e. Loaded content is considered as MovieClip.


Consider slave.fla has following code:

var SlaveText:TextField = new TextField();
SlaveText.background = true;
SlaveText.autoSize = TextFieldAutoSize.LEFT;
addChild(SlaveText);



We can access SlaveText TextField to master.fla as LoadedSWF.SlaveText.

On send_btn click we directly get text in SlaveText into masterText as,

masterText.text=LoadedSWF.SlaveText.text;

Thank You,
Wish You Happy Flashing and Actionscripting..........