Extending CSS capablities in Macromedia Flash Player

I am going to give a simple example using TextField.StyleSheet.transform(..). This is used to extend the CSS parsing capability. For example, "leading" is not parsed by CSS parser in Flash Player. Let's make an example for the same.

First we would extend TextField.StyleSheet by creating a subclass(StyleSheetEx) and overriding it's transform method.

  • StyleSheetEx.as
    import TextField.StyleSheet;
    
    class StyleSheetEx extends TextField.StyleSheet {
    
      // override the transform method
      function transform(style:Object):TextFormat {
    	var _fmt:TextFormat = super.transform(style);
    	for (var z in style) {
          if (z == "leading") {
            _fmt.leading = style[z];
    		delete style[z];
            break;
          }
        }
    	for(var i in _fmt) {
    		trace(i + " : " + _fmt[i]);
    	}
       	return _fmt;
      }
    }
    // end class definition

    </code> </li>

  • style.css
    p {
    
    	leading:10;
    	font-style:italic;
    	font-family:arial;
    	text-decoration:none;
    }

    </code> </li>

  • StyleSheetEx.fla
    import StyleSheetEx;
    
    this.createTextField("_txt",this.getNextHighestDepth(), 50,50, 400,200);
    _txt.multiline = true;
    _txt.html = true;
    _txt.wordWrap = true;
    _txt.text = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nunc erat est, dapibus id, porttitor a, nonummy nec, augue. Vivamus non felis. Quisque posuere, est et iaculis convallis, felis eros tempor lectus, vel tempor dolor diam quis nisl. Donec tincidunt pellentesque leo. Donec eget nisl. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Morbi sit amet arcu ac magna elementum tristique. Nam fermentum.";
    
    var _css:TextField.StyleSheet = new StyleSheetEx();
    
    _css["owner"] = this;
    _css.onLoad = function(bSuccess) {
    
    this.owner._txt.styleSheet = this;
    
    }
    
    _css.load("style.css");
    

    </code> </li> </ul>

    You can also see demo this example.

    Create above files with code and test it. I hope, "leading" works for you also. I know there could be many better ways, as I can see many enhancements in the above code. Please feel free to suggest.

Berkeley Trip

No I was not part of this trip, I missed it...
Most of the people from our group went to this trip and they really enjoyed it. They could enjoy more if it would have been a sunny day...
Manish has some photos & videos on his new blog.
I will also be posting pictures soon, yup! I am playing with my camera lately.

Macromedia: The Story

I didn't know that Macromedia: The Story presentation is online, I came to know while looking at Kevin Lynch's blog.
If you are curious to know that how Macromedia started and progressed over the years. Look at the story.

Macromedia India site

Finally, macromedia.com has some space for Macromedia India :)
Keep looking at this page for job openings in Macromedia India or other updates.
http://www.macromedia.com/go/india/

Flash Projector: Stopping multiple instances from running

Just posted this on IndiaMMUG.

Google Desktop Search

Google is the best(IMO) search engine. Now they have released Google Desktop software, which searches local file system and believe me its many times faster than window's built-in search. Its indexing algorithm is just superb which makes searching very fast. Google Desktop runs as a local server and keep indexing file system in background.
I am finding it cool...get it here.

Naba has got a blog...

Naba Kumar, one of the popular guys in Linux community, has a blog. I got to know this while a little YIM chat to Naba.
Those who doesn't know much about him, he is the founder and lead developer of famous Anjuta IDE project.
Another news which made me happy, that he is getting married on Oct 25, 2004. Entire community should wish and congratulate him.

I am fine now...

Have been sick for last two days. Recovering from cold and fever. We have some work load as well as some training sessions everyday.
Its fun doing all these, sometimes tiring also :)


Well, nothing much to update as I have not seen much in San Francisco. I hope, I will take sometime to explore.
Yeah! I have been to Love Parade, this was the first time it happened in USA. It was nice to see such an event. Love Parade is kind of moving techno-musical parade where many-different DJs play music. It was crowdy, generally you don't see so many people together in San Francisco. That day, Love parade started from a place very close to my apartment and moved to SBC park. SBC park is a place where most of the major baseball games in San Francisco are played.
I didn't have a camera by that time so I couldn't click some pictures in Love Parade but it would have been nice to click some pics. So I decided to buy one and bought a canon camera same evening albeit it costed a lot(almost $510 including camera, international warranty, charger and sales tax..its really high) because of my hasty decision of buying it. Later I found that a site offering something in quite less and deal could have been nice here. Anyways, now I have taken so should not regret :)...Its cool camera though.
Lately, I am trying to have more grip on FLEX. Its somewhat very new to me. BTW! I have not worked in Flash IDE for last two months, I feel bad :(.
I must say, you can really make RIAs very fast in FLEX because of Rich class/component library and data services. Moreover, developer can work in one scope i.e. a text editor, very friendly. BTW there is a non-commercial license available for FLEX. Lot more easier now for developers to deploy non-commercial apps.

Met Vera..

It was first day in our 606 Townsend office. I met, Vera outside of 600 Townsend office. She was passing by and I recognized her as soon as I saw :). We had little chat then and later also.
I also saw Mike while he was in a meeting. So I could not talk to him today. I hope to see him tommorow.
I also saw Manisha Masher of Central team. Its a great feeling to see these people in person.


Why I am writing all these ? Because, I have seen photographs of some of the good or the best Flash developers, Macromedia people, Macromedia offices and different Flash conferences over two three years. These pictures always worked as inspiration to me and motivated me.
Today I am among some of the best developers in Macromedia, I am learning something everyday. I want to be like them, want to be doing great stuff, want to have good fundas of programming, maths, datastructures etc etc and ofcourse want to contribute to products as much as I can. I know, wishes never end...
But I really have a long way to go, even after four years of experience, I am finding myself as fresher here. Lot of things to do, 24 hrs of day or 30 days of month or 365 days of a year is not enough. I really have a long way to go.
I hate to talk about myself and my dreams. But I really don't have anything to post. I want to post something useful, but for now please bare with posts about myself :)

Animation Package: ActionScript 2 Library

A set of classes for creating different type of animations can be found here.
I thought to post as I personally find them very useful. Hope it helps someone...