How to know box radius using action script

Posted by druva | Flex, as3, utils | Sunday 31 January 2010 2:59 am

<?xml version="1.0" encoding="utf-8"?>
<mx:Application
    xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="vertical"
    xmlns:local="*">
    <mx:Box width="250" height="250"
    cornerRadius="{cRadius.value}"
    borderStyle="solid"
    borderColor="0xFF0000"
    backgroundColor="0xFFFFFF"
    borderThickness="0" y="10" x="39">
    </mx:Box>
    <mx:HSlider id="cRadius"
        value="20"
        width="200"
        snapInterval="1"
        minimum="0" maximum="125"
        liveDragging="true"/>
</mx:Application>
 

BlurFilter for Images using Flash ActionScript

Posted by druva | Flash, Flex, as2, as3, utils | Saturday 30 January 2010 12:44 pm
package {

import flash.utils.*;
import flash.display.*;
import flash.net.*;
import flash.geom.*;
import flash.events.*;
import flash.filters.*;

public class DocumentClass_blurfilter extends MovieClip {

private var urlLoader:URLLoader = new URLLoader();
private var mc:MovieClip = new MovieClip();

public function DocumentClass_blurfilter() {
urlLoader.dataFormat = URLLoaderDataFormat.BINARY;
urlLoader.load(new URLRequest('http://www.totusinfo.com/blogsamples/rotary-phone1.jpg'));
urlLoader.addEventListener(Event.COMPLETE, completeHandler);
blurX.addEventListener(Event.CHANGE , onChange);
blurY.addEventListener(Event.CHANGE , onChange);
}

private function completeHandler(event:Event):void {
var loader:Loader = new Loader();
loader.loadBytes(urlLoader.data);

mc.addChild(loader);
addChild(mc);

blurX.value = 10;
blurY.value = 10;

blurX.minimum = 0;
blurY.minimum = 0;

blurX.maximum = 100;
blurY.maximum = 100;

Blur_Filter();
}

private function onChange(e:Event) {
Blur_Filter();
}

private function Blur_Filter() {
var blur:BlurFilter = new BlurFilter();
blur.blurX=blurX.value;
blur.blurY=blurY.value;
blur.quality=BitmapFilterQuality.LOW;
mc.filters=[blur];
}
}
}

(more…)

 

perlinNoise using Flash ActionScript

Posted by druva | Flash, Flex, MXML, as3, utils | Friday 29 January 2010 2:47 pm

Simple Example to show how to use perlinNoise in Flash ActionScript

In the below example the stage is divided into two parts with two different effects

example

import flash.display.*;
import flash.events.Event;
import flash.geom.Point;

var _bitmap1:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight/2, true, 0xCCCCCC);
var _bitmap2:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight/2, true, 0xCCCCCC);

function perlinNoise() {
addChild(new Bitmap(_bitmap1));
_bitmap1.perlinNoise(10, 10, 2, 50, false, true,1, true);

var b:Bitmap = new Bitmap(_bitmap2);
b.y = stage.stageHeight/2;
addChild(b)
}

perlinNoise();

var t:Timer = new Timer(50)
t.addEventListener(TimerEvent.TIMER , onTimer);
var Size = 0;
var xPos = 0;
var yPos = 0;
function onTimer (e:TimerEvent) {
var point:Point=new Point(++xPos,++yPos);
_bitmap1.perlinNoise(10, 10, 2, 50, false, true,1, true, [point, point]);
++Size;
_bitmap2.perlinNoise(Size,Size, 2, 50, false, true,1, true, [point, point]);
if(Size > 50){
Size = 0;
}
}

t.start();

(more…)

 

How to use BlurFilter with flash actionscript

Posted by druva | Flash, Flex, JS, as3, utils | Thursday 28 January 2010 1:38 pm

Simple Example to show How to use BlurFilter

example

import flash.display.*;
import flash.filters.*;

var _rectData:BitmapData = new BitmapData(200, 200);

function drawRectangle():void {
	_rectData.fillRect(new Rectangle(40, 0, 150, 150), 0xFF0000FF);

	var rect:Sprite = new Sprite();
	addChild(rect);

	var bitmap:Bitmap = new Bitmap(_rectData);
	rect.addChild(bitmap);
}

function Blur_Filter() {
	drawRectangle();
	var filter:BitmapFilter = getBitmapFilter();
	var myFilters:Array = new Array();
	myFilters.push(filter);
	filters = myFilters;
}

function getBitmapFilter():BitmapFilter {
	var blurX:Number = 60;
	var blurY:Number = 60;
	return new BlurFilter(blurX, blurY, BitmapFilterQuality.HIGH);
}

Blur_Filter();

(more…)

 

Load Date from XML File using flash actionscript AS3

Posted by druva | Experiments, Flash, Flex, as3, utils | Wednesday 27 January 2010 1:42 pm

Simple Example to show how to load xml

package
{
    import flash.display.*;
    import flash.events.*;
    import flash.net.*;
    public class DocumentClass extends Sprite
    {
        private var loader:URLLoader;
        private var xmlPath:URLRequest;

        public function DocumentClass()
        {
	 xmlPath = new URLRequest("http://server.com/xml.xml")
	loader = new URLLoader(xmlPath);
            loader.addEventListener(Event.COMPLETE, completeListener);
            loader.addEventListener(ProgressEvent.PROGRESS, progressListener);
        }

        private function completeListener(event:Event):void
        {
            trace(" all done loading " + loader.data + " and here's the xml file we loaded ");
        }

        private function progressListener(event:Event):void
        {
            trace(" loading.... " + loader.bytesLoaded + " / " + loader.bytesTotal + " bytes");
        }
    }
}
 

How to create Tag Cloud Page in wordpress

Posted by druva | HTML, php, utils, wordpress | Tuesday 26 January 2010 4:43 am

After exploring to create a cloud page  this is the way i have created one for my site

Follow the steps

1) create a php file with tagcloud.php

<?php
/*
Template Name: Tag Cloud
*/
?>

<?php get_header(); ?>

    <div id="content" class="narrowcolumn">
 		<h3 style="font-family:Arial, Helvetica, sans-serif; color:#CC6600">Tags Cloud</h3>
        <div class="tag_cloud">
            <?php wp_tag_cloud('number=0'); ?>
        </div>

    </div>

<?php get_sidebar(); ?>

<?php get_footer(); ?>

2) upload this file to server in your theme folder
in my case as i am using default theme i have uploaded to “totusinfo\blog\wp-content\themes\default”

3) Login to admin section click on create a page
4) Enter title of your page
5) Choose Tag Cloud from the Template Drop Down and click update/create

Now your tag cloud page is ready
EnJoy!!!!!

 

How to use URLVariables() in Flash AS3?

Posted by druva | Flash, Flex, as3, utils | Monday 25 January 2010 10:26 pm

Using URLVariables in Flash or Flex we can send and receive data from server he is the example

This is the PHP Code nested in the server
Create a PHP file and place it in the server

<?php
 $email=$_POST['email'];
 $password=$_POST['password'];

echo "email=".$_POST['email']."&amp;password=".$password;
?>

Here is the code in Flash/Flex

//create URLRequest instace withe the target URL
var request:URLRequest = new URLRequest("http://www.example.com/data.php");

//create instance of the class
var variables:URLVariables = new URLVariables();

variables.email = druva.flash@gmail.com;
variables.password = 'dontexpectit';

//add the data to the URLRequest
request.data = variables;

//Choose a method as POST
request.method = URLRequestMethod.POST;

var loader:URLLoader = new URLLoader();
//Create EventListener
loader.addEventListener(Event.COMPLETE, handleComplete);

//send the request with URLLoader()
loader.load(request);

 function handleComplete(event:Event)  {
var loader:URLLoader = URLLoader(event.target);
var vars:URLVariables = new URLVariables(loader.data);

//Read data for the result
trace("vars.email: "+vars.email);
trace("vars.password: "+vars.password);
 }
 

Create Color Wheel using Flex (Actionscript) AS3

Posted by druva | Flash, Flex, MXML, as3, utils | Sunday 24 January 2010 9:34 am

Working on color wheel i hope it looks good.
Cick to view working sample

 

Create Color Picker like Photoshop Color Picker using Flex and Actionscript 3 (AS3)

Posted by druva | Flash, Flex, MXML, as3, utils | Friday 15 January 2010 12:30 pm

Recently started making a color picker which is similar to photoshop color picker

 

Flash CS4 Text Effects 0.2

Posted by druva | Flash, Flex, as3, utils | Thursday 14 January 2010 2:03 pm

Just playing with Text this is my first update for the previous post
view previous post

This movie requires Flash Player 9

sample 0.2

 
Next Page »