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..........

Sunday, April 25, 2010

About Coding Standards

Flash applications are generally built without coding standards whrere as flex applications have some standard.
Next version of Flash (CS5) have code hinting properties where as Flex already have it.
This flexibility allows solutions to variety of  problem.
It is very difficult for anyone to understand others code. Even sometimes when code becomes wast author may have difficulty for reading his or her own code.
If a developer unable to understand the code in an application, it will not be easy to debug the code, make changes, or reuse the code.

Optimization is also one of the important factor, while you are playing with Flash, Flex or ActionScript.

Here are some useful links i found while surfing on net.

Coding Standards:
http://www.rivellomultimediaconsulting.com/files/presentations/2012/BestPractices_Coding_v1.1.pdf
http://download.macromedia.com/pub/devnet/downloads/actionscript_standards.pdf

Video:
http://www.adobe.com/devnet/flash/articles/flash_to_video.html

Image:
http://www.kirupa.com/forum/showthread.php?320007-Image-Quality-in-Flash

Optimaization:
http://www.kirupa.com/forum/showthread.php?339677-Optimise-the-game
http://gamedev.michaeljameswilliams.com/2010/02/10/optimise-as3-for-speed/
http://osflash.org/as3_speed_optimizations
http://lostinactionscript.com/2008/09/28/tips-on-how-to-write-efficient-as3/
http://wiki.joa-ebert.com/index.php/Category:Code_Optimization
http://board.flashkit.com/board/showthread.php?t=788271

Access of MainTimeline to class file

Here is code for How to access MainTimeline objects in fla to .as class file.

In main.fla,
There are two text boxes SentText and gettext.
code is:

import com.sample

var sample:Sample=new Sample(this)
sample.SentText("Sent to Class File")
gettext.text=sample.GetText();

Here this keyword  represents MainTimeline, to class sample , when instance of that class is created.

in Sample.as

package com
{
public class Sample
{
private var SuperObject:Object;
public function Sample(mySuperObj:Object)
{
SuperObject=mySuperObj;
}
public function SentText(str:String)
{
SuperObject.Mytext.text=str
}
public function GetText():String
{
return SuperObject.Mytext.text;
}
}
}


Here SuperObject is a variable of type Object , which represent MainTimeLine.
When object of class Sample is created, MainTimeline is passed to Sample Class constructor.
If we trace (SuperObject) it shows [object MainTimeline].
If you write this code in document Class, this document Class represent MainTimeLine
and now we can access of objects of MainTimeLine as seen.

Thanx;
Enjoy Actionscripting..........