Must read Flash / Flex Magazine
Posted June 2, 2009
on:- In: Actionscript 3.0 | AIR | Flash CS3 | Flex
- 3 Comments
FFDMag had excellent magazine for flash and flex programmers having articles ranging from Beginner Level to expert levels. Just check some of the topics below
- Flash Flex developer interview with Dave Schroeder about the Flashbelt Conference…
- BannerSnack – A quick alternative to Flash?…
- Working With Flash CS4 New Features: Inverse kinematics (IK) with Bone Tool…
- Tracking Time with Screenweaver HX…
- Using all the different components within CS4 to built a complete site…
- Model View Controller – What’s the Secret Sauce… ?…
- JSFL Quirks…
- SWX: The Native Data Format for Adobe Flash…
- An introduction to Flickr In Flash…
- Flash video and AS3…
- WebORB tricks…
- Multi-user Applications in haXe…
- Achieving a retro-style using only Flash…
- Secrets of a professional Flash game programmer…
- Interview with Lee Brimelow…
You can subscribe this magazine from the following link
- In: Actionscript 3.0 | Flex
- 3 Comments
I have faced a problem when i tried to have a canvas with rounded corner and having an image. I doesn’t want to make the rounded corners in image as the content is going to be scaled. After doing some research on Net i found a good solution to the problem. it is a kind of trick where you put the rounded corner canvas as a mask on your image and it works perfectly :). Following is the code for the same
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Image source="../bin-debug/assets/bg.jpg" x="10" y="10" mask="{maskCanvas}" height="80%" width="80%" maintainAspectRatio="false" />
<mx:Canvas id="maskCanvas" x="10" y="10" width="80%" height="80%" cornerRadius="10" borderStyle="solid">
</mx:Canvas>
</mx:Application>
Do remember to create an asset folder having a “bg.jpg” image when trying this solution.
- In: Macros | VB
- 2 Comments
A very nice utility
Sub CreateListOfSheetNames()
Set wkbkToCount = ActiveWorkbook
iRow = 1
With Sheets.Add
For Each ws In wkbkToCount.Worksheets
.Rows(iRow).Cells(1).Value = ws.Name
ActiveSheet.Hyperlinks.Add Anchor:=.Rows(iRow).Cells(1), Address:="", SubAddress:= _
ws.Name & "!A1", TextToDisplay:=ws.Name
iRow = iRow + 1
Next
End With
End Sub
- In: Actionscript 3.0 | AIR | Flash CS3 | Flash Player | Flex
- 6 Comments
Following is a code to remove a child from a parent by passing it’s instance name as a string and parent as a display object
import fl.controls.Button;
//———– Draw a graphics on the stage ———-
var t:Sprite = new Sprite();
t.name = “testSprite”;
t.graphics.lineStyle(1,0x0000ff);
t.graphics.beginFill(0xff0000);
t.graphics.drawCircle(0,0,50);
t.graphics.endFill();
addChild(t);
t.x =100;
t.y = 100;
//———– Remove Child Function ————–
function removeChildWithRef(spriteName:String, parentObj:*){
var t:DisplayObject = parentObj.getChildByName(spriteName);
parentObj.removeChild(t);
}
//————- Add a Button to Stage ————
var tBtn:Button = new Button();
tBtn.label = “Remove Circle”;
tBtn.x = 50;
tBtn.y = 170;
tBtn.addEventListener(MouseEvent.CLICK,onClick);
addChild(tBtn);
//———— Capture Click Event ————-
function onClick(evt:MouseEvent){
removeChildWithRef(“testSprite”,this);
}
- In: Actionscript 3.0 | AIR | Flash CS3 | Flex
- 2 Comments
While reading a book i come to a very interesting topic which i would like to share here
———————–
By default, The bitmap instances that reference a given BitmapData object are notified every time setPixel32( ) or setPixel( ) is called on that object. When setPixel32( ) or setPixel( ) are used in rapid succession within the same frame cycle—such as when setting the color of every pixel in a bitmap—these notifications can reduce performance. To improve performance, we can use the BitmapData class’s instance method lock( ).
Calling lock( ) on a BitmapData object forces ActionScript to not notify dependent Bitmap objects when executing setPixel32( ) or setPixel( ). Hence, before using setPixel32( ) or setPixel( ) in rapid succession, always call lock( ). After calling lock( ), assign all desired pixel color values; then call the BitmapData( ) class’s instance method unlock( ). Calling unlock( ) instructs ActionScript to notify all dependent Bitmap objects as necessary.
Example below demonstrates the approach. The example uses a loop to assign a random color to every pixel in a 500 × 500 BitmapData object. Notice the call to lock( ) before the loop and unlock( ) after the loop.
- In: Actionscript 3.0 | AIR | Flash CS3 | Flex | Flex Components
- 4 Comments
The following code is solution to a problem where you need to make the accordion component’s MouseOver event to behave like a click event. The code will work only in the case if you have not given the names to the AccordionHeader explicitly. Check the solution out here
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
public function onMouseOver(evt:MouseEvent):void{
var strName:String = evt.target.name;
var strLen:int = String("_header").length;
if(strName.indexOf("_header") > -1){
accordion.selectedIndex = int(strName.substr(strLen,strName.length));
}
}
]]>
</mx:Script>
<mx:Panel title="Accordion Container Example" height="90%" width="90%"
paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">
<mx:Label width="100%" color="blue"
text="Select an Accordion navigator button to change the panel."/>
<mx:Accordion id="accordion" width="100%" height="100%" mouseOver="onMouseOver(event)" >
<!-- Define each panel using a VBox container. -->
<mx:VBox label="Accordion Button for Panel 1">
<mx:Label text="Accordion container panel 1"/>
</mx:VBox>
<mx:VBox label="Accordion Button for Panel 2">
<mx:Label text="Accordion container panel 2"/>
</mx:VBox>
<mx:VBox label="Accordion Button for Panel 3">
<mx:Label text="Accordion container panel 3"/>
</mx:VBox>
</mx:Accordion>
<mx:Label width="100%" color="blue"
text="Programmatically select the panel using a Button control."/>
<mx:HBox>
<mx:Button label="Select Panel 1" click="accordion.selectedIndex=0;"/>
<mx:Button label="Select Panel 2" click="accordion.selectedIndex=1;"/>
<mx:Button label="Select Panel 3" click="accordion.selectedIndex=2;"/>
</mx:HBox>
</mx:Panel>
</mx:Application>
Attaching MovieClip from library by passing classname as a string in function in AS3
Posted September 26, 2008
on:- In: Actionscript 3.0 | AIR | Flash CS3 | Flex
- 20 Comments
The post contains a solution for a case where you need to attach a Library symbol and you have to pass that class name as a string to the function.
The approach followed here is by using the getDefinitionByName utility which interprets the string and convert it into a Class. Then you can use a new syntax with that particular class. Following is a code for the same solution and you can download the source files from here. The “testMC” here is a movieClip in library with the className as testMC and BaseClass as flash.display.MovieClip
import flash.utils.getDefinitionByName;
function addMovieFromLibrary(mcIName:String){
var tMC:Class = getDefinitionByName(mcIName) as Class;
var newMc:MovieClip = new tMC() as MovieClip;
addChild(newMc);
}
addMovieFromLibrary("testMC");
- In: AIR | Flash Player
- 2 Comments
Adobe had released the Flash CS4 professional edition at a preorder price of $699. Following are the Some of highlighted features
- Object-based animation
- 3D transformation
- Procedural modeling with Deco and Spray Brush
- Metadata (XMP) support
- Authoring for Adobe AIR
- XFL support
- Inverse kinematics with the Bones tool
- Motion editor
- Motion presets
- H.264 support
Check here for more details
http://www.adobe.com/products/flash/features/?view=topnew&promoid=DRHWS
AS3 XML Loader Utility Class
Posted September 23, 2008
on:- In: Actionscript 3.0 | AIR | Flash CS3 | Flex | Flex Components | Xpath
- 7 Comments
I have developed this XMLUtility class in conjunction with a CustomEvent Class which returns me the loaded XML/String Data along with the complete event firing. You can download the sources from here. Following is the code you need to write when you want to load this class
//------------ Import Classes
import com.flexcomps.utils.CustomEvent;
import com.flexcomps.utils.XMLLoaderUtil;
//-------- Create instance of loader class
var xmlLoader:XMLLoaderUtil = new XMLLoaderUtil();
xmlLoader.addEventListener(CustomEvent.ONLOADED, onXMLLoaded);
xmlLoader.load(xmlPath);
//----- Method to handle the returned data
private function onXMLLoaded(evt:CustomEvent) {
xmlData = evt.data as XML;
trace(xmlData);
}
Recent Comments