Posts

Showing posts with the label flash

Customise Combobox/DropDown in Flash

I am always wonder how to customise the Combobox component in Flash . It's easy to change the skin. Simply double click the component , enter each movieclip and change the style. But ever wonder how to change text color and it's position. I will try to point out step by step procedure for customise it. 1. First create a class which extends ComboBox. I used  DropDownComboBox for class name. 2. Second create another class for Cell render which extends  CellRenderer. I used DropDownCellRenderer; 3. Open a new flash document  and insert a combobox component in the stage. 4. Select ComboBox clip in the library. Right click on it and select Properties.   5. In the properties panel change the default Class to the custom class you wrote . ie,  DropDownComboBox  6. Inside the DropSownComboBox constructer function type this code  dropdown.setStyle('cellRenderer', DropDownCellRenderer); 7. If you need to change the Text of ComboBox...

Upload Video to Facebook Using Actionscrpt 3.0

For the last one week am searching for uploading video to Facebook using Graph Api from Flash. First challenge is to find something which will help to capture video from webcamera and convert it to ByteArray. The problem is Actionscript doesn't had any utlity to save video from webcamera. It uses Flash media server to save video. But i need something which not uses any server side acript. After searching several hours in google i found a link. http://www.zeropointnine.com/blog/updated-flv-encoder-alchem/ In this utility it uses snapshots from the webcamera which will encode it . Though it had some drawbacks and limitations, it serves my requirement for small videos. I used it for creating videos. Next i need to upload video to facebook. This is the api used to connect facebook using Actionscript. http://code.google.com/p/facebook-actionscript-api/ This API uses a different function for uploading videos to facebook . Facebook.uploadVideo(). The reason for different...

Connecting Flex 4 with AMFPHP

These days am missing this blog coz am busy with learning Flex. When i tried to connect with AMFPHP i can't find anything useful. Most of them were vague .Using the default data connectivity in Flash Builder am more confused and it's code looks complex . Atlast i found someone helpfull from adobe forum . When i tried to implement it , it shows nothing and missing some files. When i checked the PHP file, though am not good in PHP , i found there is also something also missing. I tried and searched and corrected the files. Here is the MXML code: import flash.events.MouseEvent; import mx.controls.Alert; import mx.events.FlexEvent; import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; protected function getAllEmployees_resultHandler(event: ResultEvent): void { dataGrid.dataProvider = event.result; } protected function getAllEmployeesByID_resultHandler(event: ResultEvent): void { dataGrid.dataProvider = event.result; } protected function createEmployees_result...

Font embedding in Flash cs5

Image
When i switched to Flash CS 5 am always confused with font embedding in Dynamic Textfield. It's different from CS4 and also not simple. So i am trying to list out the methods i used to embed fonts in flash CS Method One It's used to embed fonts for single or similar type of textfields. If the textfields were using same font and format this is effective. To do so first select the TextField and goto the properties panel. select the embed button . It will open embed window. select the glyphs needed. In this method any additional code is not needed. Method Two If you tried to embed same font with different textformat using the above method , most probably the format will not be applied. To solve this the subset of the fonts should be embedded and need format textfield using TextFormat. The code looks like this: var format:TextFormat = new TextFormat(); format.font = "Helvetica"; format.bold = true; var format3:TextFormat = new TextForm...

Customizable XML based Flash image scroller

I missed this blog for more than  2-3 months. It's been a long time since i have wrote something usefull . So i created a image scroller using XML .This scroller uses TweenLite for tweening and it's simple to customise. You can add image with any size and can customize the number of images shown. I have shared the source code here. Requirements 1. Flash CS5 http://www.adobe.com/products/flash/ 2. TweenLite AS3.0 http://blog.greensock.com/tweenlite/ It's possible to change the attributes through xml if you wanted . Read the params from xml and add to the local variable inside the function onXmlLoadComplete . //Total number of images : private var total:Number = 0; //Current item to be displayed; private var currentId:Number = 0; //The number of items to be shown ata a time: private var itemsToShow:Number = 4;

Perspective problem in Flash native 3D

Nowadays am busy with some projects in flash using it's native 3D. In this post i like to share my experience with flash 3D. The native 3D in flash Player 10 is awesome. I used some flash coverflow and 3D picture gallery in project. First it seems very easy but soon i found that resizing of the stage cause some problems in the 3D perspective. I searched everywhere and found some wonderfull thing. Whenever we use 3D properties flash will automatically convert it to some bitmap and its in the 3D space. After that if we try to resize the stage and align the component according to the stage size flash projectioncenter will change . So we need to reset it by using the following code. stage.addEventListener(Event.RESIZE,onSize); private function onSize(e:Event) { root.transform.perspectiveProjection.projectionCenter=new Point(stage.stageWidth/2,stage.stageHeight/2); }

Why i like to use Casalib

I just started playing Actionscript 3.o. And I got some problem with Evnts. My code looks like something like this. My movieClip Class is like this. package{ import flash.display.MovieClip; import flash.events.Event; public class MC extends MovieClip { var val=1; var _o; public function MC() { _o=this; _o.addEventListener(Event.ENTER_FRAME,onLoop); } private function onLoop(e:Event) { trace(val); val++; } } } It's the code in the main.fla b1_btn.addEventListener(MouseEvent.MOUSE_DOWN,clicked); var m:MC=new MC(); addChild(m); function clicked(e:MouseEvent) { removeChild(m); m=null; } The problem i get is with enterframe. After removing the Movieclip from the stage, enterframe don't stop it's working. So i posted this in forums. It's the problem of garbage collection. Till now am playing with Actionscript 2.0 i never think about the garbage collection. The solution is to remove listeners manually or just use REMOVED_FROM_STAGE or REMO...

External models in Papervision3D

I think am taking a bit more interest in Actionscript 3.0 . Coz now am trying Papervision3D . The thing attracted me most is the loading of external model to flash . So i searched google and got this book. http://blog.papervision3d.org/2009/09/03/papervision3d-essentials/ I got what am looking for , in the free chapter . First i can't understand a word from that .Coz i have little exposure in 3D. So i worked with my genius designer and after a a long struggle am able to load the external models to flash. I decided to document the steps. For this you need these 1. Flash professional 2. Autodesk 3D studio 3. Papervision3D http://blog.papervision3d.org/ 4. Collada plugin You can use 2 plugin's one is from here http://sourceforge.net/projects/colladamaya/files/ and another from open collada http://opencollada.org/download.html better use opencollada as it is has less dependancies. The former one requires updating the VC and DirectX . Download it from here http://www.micr...

Flash FLVPlayer in ActionScript 3.0

Actionscript 3.0 , oh my god am scared of it . Whenever i know about actionscript 3.0 am confused with it.I have exposure only in AS 2.0 . I searched google for a year and could not get rid of this fear. I read several books but none help me to understand the AS 2.0 . I have a good exposure in JAVA . But the thing is i can't differentiate OOPs with timeline based one. Then i got this book. Learning ActionScript 3.0 by Rich Shupe and Zevan Rosser It's wonderful and awesome . When started reading this book my curiosity cross the limits and started to experiment with AS 3.0. As my main area is video , i experiment it with a flv player . It may have problems and ubiquitous as it is my first experiment with AS 3.0. Anyway am sharing my source code and expecting some comments over it. Requirements 1. Flash CS4 http://www.adobe.com/products/flash/ 2. Learning ActionScript 3.0 http://www.learningactionscript3.com/

Dynamic XML/PHP driven rotating scroller using Tweenlite

Oh My god , i had a blog here. I really forgot about this. :( Now it's time to update my blog with a new thing . It's not so good one. Just tried to develop one simple scroller with rotating thumbs. You can change it to a XML/PHP driven scroller. Till now am using Adobe default tween and Tweener class . Then i found another famous one , Tweenlite .It's fast and reliable for me. I never tried it. So decide to try it and develpoed a simple scroller. You can have the source here . Requirements 1. Flash CS4 http://www.adobe.com/products/flash/ 2. TweenLite AS2.0 http://blog.greensock.com/tweenlite/ It's just another example . You can change to dynamic one by XML or PHP.

Flash Live Streaming Player

After a long time i am back with my player.This time i want to use my player as a live player.The changes where simple and it is handy to develop this functionality in Flash Media Server 3.I just uploaded the source and you can download it from here . The source is developed in Adobe Flash CS3. How to setup the player? 1. Install Flash MediaServer 3 2. Install Adobe Flash Media encoder 2.5 3. Check there is an application called live in your Application folder in the FMS installation directory. 4. Attach any video device(webcam) to the computer. 5. Start FMS and Media Encoder 6. Check Stream to Flash Media Server section in media endcoder 7. set the FMS url "rtmp://localhost/live/" and Stream "livestream" 8. Check the playe.as You can the stream name and application in it. 9. Start the media encoder that's all ready to check the player. Enjoy it.... feel free to contact me for help...I will try my level best...

Flash FLV player using PHP

After a long experiments , i have developed another player which uses XMOOV for streaming.Actually i got this php from flashcomguru.com .I didn't change the php file instead of it i developed a player using this php. The player will start streaming anywhere from the file and it also make the seeking operation in the cached file. Download Source here I have no server space so i use freewebs space ,.Pls forgive me :D The main problem of this technology is the performance of the php server.It need a good php server which can handle more requests at a time. Other problem is the encoding of the flv. Flv file should be added with the 'keyframes' metadata . So it need another utility called metadata injector ,which will inject metadata to the flv. It can be downloaded from here. That's all ..... and all other ups to you. Try this.. If you are using this file please let me know your feedback.

Fullscreen in flash

I am always confused with the fullscreen issue in flash in browser. At last,after many experiments i have developed a player which will support fullscreen. As this player may not be so good as many other Flash videoplayer ,consider as a experiment. The player will receive the path to the flv as "path" param . You can watch my experiment here. I am happy to share my files with you. You can download from here It containts: 1.The .fla file developed in "Flash CS3" 2.Player.as file 3.player.swf 4.flv folder which contain the flv file. For testing purpose copy any flv of size 400 X 300 and rename as test and open the html in browser. Please comment your opinions ,suggetions and doubts... NOTE:The file developed in FLASH CS3 2.The Flv should be exactly of 400X300 size.