|
Sep 24 |
Thought I would post this little script since I have been working with videos and volume and I know I will forget it.
1 2 3 4 | function setVol(newVol : Number):void // use 0-100 { SoundMixer.soundTransform = new SoundTransform(newVol/100); } |
Thought I would post this little script since I have been working with videos and volume and I know I will forget it.
On our previous article we talked about using dependency injection for our models and views. Next we will talk about how to incorporate the model into our command. At first I thought of “how does Mate handle this” and remembered that you can pass constructor arguments into the manager(which is basically the Cairngorm command). Hmmm…it only makes sense since the command has to know about the model but how to implement this in a clean way…
If anyone has ever used Cairngorm in larger applications you probably have come across the popular problem of “ModelLocator.getInstance()” being sprinkled all over your app. And if you have ever researched your problem you have probably come across, more then you care to count, of heated discussions over the overuse of Singletons in Cairngorm. If you really want find reasons NOT to use Cairngorm just ask Theo. But, fortunately there are plenty of frameworks popping up for you to choose from Mate, Swiz, and PureMVC. I have tried all of them and currently Mate seems to be the new kid on the block and becoming more and more popular. First off let me say I don’t dislike Mate I think it is a very robust framework I really enjoy the dependancy injection approach and the simplicity of using the built-in event system of Flash. But I have found that when implementing larger applications the EventMap can get very bulky and extremely complicated (especially when another developer has to jump into your code) also I just am not a fame of the tag-based system. Yes that is it! It is not because of some “proper instatiation of design pattern xxx” or improper use of MVC.
Recently I found a post here on how to add .svn to your filters list in Flex Builder. But I wasn’t too sure how to add a filter list in Eclipse for the Flex Builder Plugin. As I found out it is pretty simple. Navigate to your Flex Builder 3 Plug-in -> eclipse -> plugins and find your com.adobe.flexbuilder.ui_3.0.xxxxx folder. Inside the folder you want to find your plugin.xml file and then simply add in the following.
Save the file and make sure to do a -clean on eclipse.
If you are like me you have a substantial ActionScript library from Papervision3D to Tweener and fortunately most of them come with some type of documentation. Now while that is all well and good I find myself time and time again searching through individual documentation packages to find information. Well wouldn’t that be nice if all my source documentation could be in a central location, and that is where ASDoc comes into play. I knew somewhat about the ASDoc tool (which is included with the Flex SDK) but I really haven’t touched it, a quick search and I found some nice documentation on how to use it through the command line. Now that is perfectly fine but haven’t you ever wondered what that Run->External Tools option does in Flex Builder?
A few months back another developer contacted me and was in utter confusion on a problem he was having. The situation was, he was loading .xml files for their dynamic textfields and then was trying to link the text to some function. He sent me some crazy code which was trying to determine if the text was the correct keyword and then dynamically drawing an invisible button over it with an event and …blah…blah…blah… Which in the end did not work and was a pain in the @#$ to try and comprehend. Now I remember back in AS2.0 you could use the asfunction call to invoke a function in ActionScript. Since I had not tried it in AS3.0 I thought I would give it a shot:
Basically all I am doing is calling ‘myFunc’ and passing the argument ‘Foo’, but not to my amazement it did not work. Of course, as any developer would do, I jumped into the documentation in the TextEvent class and found the LINK event. After a little bit of reading this seemed to fit the bill. And walla:
Here is a working sample of the application with .xml.
|
| |||||||||||||||||||||||||||
Recent Comments