Hi guys today I come up with another video series in which you will learn how to bring Tweets into Flash using the Twitter API.
Part One
Second Part
Thanks for watching and hope that they will be helpful.
Hi guys today I come up with another video series in which you will learn how to bring Tweets into Flash using the Twitter API.
Part One
Second Part
Thanks for watching and hope that they will be helpful.
1. Create a simple movie clip with registration point from where you want it to rotate.
2. Select the movie clip and paste the below given script onto that
onClipEvent (enterFrame) {
myRadians = Math.atan2(_root._ymouse-this._y, _root._xmouse-this._x);
myDegrees = Math.round((myRadians*180/Math.PI));
_root.yChange = Math.round(_root._ymouse-this._y);
_root.xChange = Math.round(_root._xmouse-this._x);
_root.yMove = Math.round(_root.yChange/20);
_root.xMove = Math.round(_root.xChange/20);
this._y += _root.yMove;
this._x += _root.xMove;
this._rotation = myDegrees+90;
}
That’s it you are done.
For drawing a blue line we will write code:
var sp:Sprite = new Sprite();
addChild(sp);
var g:Graphics = sp.graphics;
g.lineStyle(3, 0x1c2fba);
g.moveTo(80, 100);
g.lineTo(420, 100);
For drawing yellow and red lines we will write code:
var sp:Sprite = new Sprite();
addChild(sp);
var g:Graphics = sp.graphics;
g.lineStyle(3, 0xfaf100);
g.moveTo(80, 80);
g.lineTo(420, 150);
g.lineTo(400, 120);
g.lineTo(200, 120);
g.lineStyle(4, 0xFF0000);
g.moveTo(150, 175);
g.lineTo(400, 175);
For drawing curve we will write code;
var sp:Sprite = new Sprite();
addChild(sp);
var g:Graphics = sp.graphics;
g.lineStyle(2, 0x467608);
g.moveTo(150, 100);
g.curveTo(275, 0, 400, 100);
g.moveTo(0, 0);
For drawing a triangle and fill it with color we will write code:
var triangle:Sprite = new Sprite();
with (triangle.graphics) {
lineStyle(0);
beginFill(0x9e0fa3,1);
moveTo(50, 0);
lineTo(120, 120);
lineTo(0, 100);
lineTo(50, 0);
endFill();
}
triangle.x = 50;
triangle.y = 250;
addChild(triangle);
For drawing a Circle and fill it with color we will write code:
var shapes:Sprite = new Sprite();
var gr:Graphics = shapes.graphics;
gr.lineStyle(4, 0x068843, .5);
gr.beginFill(0x330066, .2);
gr.drawCircle(50,50,50);
gr.endFill();
shapes.x = 150;
shapes.y = 250;
addChild(shapes);
For drawing a Circle and fill it with color we will write code:
var shapes:Sprite = new Sprite();
var gr:Graphics = shapes.graphics;
gr.lineStyle(4, 0x330066, .5);
gr.beginFill(0x330066, .2);
gr.drawRect(125,0,100,100);
gr.endFill();
shapes.x = 150;
shapes.y = 250;
addChild(shapes);
Thanks. Looking for feedback.
Hi, in this tutorial you will learn how to build a flash application to search the phonebook. Also you will come to know how to handle input field and many more aspect of flash scripting.
1. Create a new file in flash. choose the background color and dimension. for make this application more appropriate choose a telephone image from anywhere you like and import it to flash stage with Ctrl+R.
Make a new layer name it actionscript and on the first frame paste below given script
var directory:Array = [{name:"Sven", phone:"854-664-9652"}, {name:"Michel", phone:"459-6996-4522"}, {name:"Jack", phone:"895-659-4485"}, {name:"Charly", phone:"956-8596-5243"}, {name:"Ana", phone:"127-25485-6695"}];
function getPhoneByName(name:String):String {
for(var i:Number = 0; i < directory.length; i++) {
if(directory[i].name.toLowerCase() == name.toLowerCase()) {
return directory[i].phone;
}
}
return "No Match";
}
searchButton.onRelease = function() {
resultField.text = getPhoneByName(nameField.text);
}
Script explanation:
This script:
var directory:Array = [{name:"Sven", phone:"854-664-9652"}, {name:"Michel", phone:"459-6996-4522"}, {name:"Jack", phone:"895-659-4485"}, {name:"Charly",
phone:"956-8596-5243"}, {name:"Ana", phone:"127-25485-6695"}];
create a directory with five objects, and every object has properties, name and phone.
This script
function getPhoneByName(name:String):String {
for(var i:Number = 0; i < directory.length; i++) {
if(directory[i].name.toLowerCase() == name.toLowerCase()) {
return directory[i].phone;
}
}
return "No Match";
}
defines a function that will be searching directory field to find the concerned phone number. This function like parameter, accept the name and returns result as string.
And this script:
searchButton.onRelease = function() {
resultField.text = getPhoneByName(nameField.text);
}
provides us, that on click on the search button we have a final result.
We're done!
Test your Movie (Ctrl+Enter).
Source: https://sites.google.com/site/pageflipsite/circle/1842621_PhoneBook.fla?attredirects=0&d=1