Thursday, May 31, 2012

[Action Script] dashboard(speedometer) May,2012

how to create dashboard(speedometer) and what coding action Script?
dashboard(speedometer)

[Action Script] Display external swf with multiple pages May,2012

Hello Everyone

I am new to action script.

I have converted a pdf with multiple pages into a swf file.

Is there a way to display the swf file with multiple pages in action script and have the ability to move between pages?

Thanks
Display external swf with multiple pages

[Action Script] can a round hit box be made? May,2012

So i'm making my first as3 game and its just a simple avoider style game. I've got most of the basics working but the objects that are being avoided are circles and since im using hitTestObject i get a square hit box :p. Is it possible to create a circular hit box?

Heres my code

ActionScript Code: package {    import flash.display.*;    import flash.events.*;    import flash.text.*;    import flash.utils.Timer;    import flash.utils.getDefinitionByName;        public class mattGame extends MovieClip {        var ship:Ship;        var gameTimer:Timer;        var army:Array;        var score:int = 0;        const speed:Number = 7.0;                public function mattGame() {                army = new Array();            var newEnemy = new Enemy( 250, -15 );            army.push( newEnemy );            addChild( newEnemy );                        ship = new Ship();            addChild(ship);                        gameTimer = new Timer( 25 );            gameTimer.addEventListener( TimerEvent.TIMER, onTick );            gameTimer.start();        }        public function onTick( timerEvent:TimerEvent ):void {            if ( Math.random() < 0.1 ){                var randomX:Number = Math.random() * 500;                var newEnemy:Enemy = new Enemy( randomX, -15 );                army.push( newEnemy );                addChild( newEnemy );            }            ship.x = mouseX;            ship.y = mouseY;                        for each ( var enemy:Enemy in army ){                enemy.moveDownABit();                if ( ship.hitTestObject( enemy ) ){                    gameTimer.stop();                }            }        }    }}
end the enemy class to

ActionScript Code: package {    import flash.display.MovieClip;    public class Enemy extends MovieClip     {        public function Enemy( startX:Number, startY:Number )         {            x = startX;            y = startY;        }                public function moveDownABit():void         {            y = y + 7;        }    }}
can a round hit box be made?

[Action Script] Preloading external flv for FLVPlayback May,2012

I have flash actionscript 3 project that on the second frame (after the welcome screen) loads external flv into FLVPlayback component or external mp3 for player.

I'm trying to find code for preloader to the entire project - that will show before the first screen and will preload also the external files so when the user moving to the frame with the player the flv/mp3 will be shown immediately.

is it possible to load the flv into some object and then assign it to FLVPlayBack component as source?

Any help will be much appreciated!

Thanks.
Preloading external flv for FLVPlayback

[Action Script] (hitTest) cannot convert to flash.display.DisplayObject May,2012

package
{
import flash.display.MovieClip;
import flash.events.Event;

public class guard extends MovieClip
{
public function guard()
{

this.addEventListener(Event.ENTER_FRAME,ouch);

function ouch(e:Event):void
{
if (MovieClip(parent).player.hitTestObject(this))
{
trace("ouch!");

}
}
}

}
}

when ever i run the codes, i will have this error:
TypeError: Error #1034: Type Coercion failed: cannot convert global@2d54f29 to flash.display.DisplayObject.
at Function/guard/$construct/ouch()[C:\Users\User\Desktop\test\guard.as:19

i cant find wheres the error coming from. help please!
(hitTest) cannot convert to flash.display.DisplayObject

[Action Script] Use slide bar to change images/frames May,2012

Hi,

I'm using this to create a slide bar:
ActionScript Code: var minX:Number = mcLine._x;var maxX:Number = (mcLine._x + mcLine._width) - mcButton._width;var absY:Number = mcButton._y;mcButton.onPress = function() {    this.startDrag(false, minX, absY, maxX, absY);};mcButton.onRelease = mcLine.onReleaseOutside = stopDrag;
And that works like a charm.

Does anyone know how I can use this slide bar to navigate between 4-5 images?

Lets say you move the slide bar 100px to the right, then a new image (01) appear. if you move the slide bar a new 100px to the right, a new image (02) appear. And so on.

Hope y'all understand my question :-)

Knut
Use slide bar to change images/frames

Wednesday, May 30, 2012

[Action Script] Load Dynamic (constantly changing) XML Data to List in Flex May,2012

I have an XML file which changes after every one minute or precisely speaking data(nodes) in the XML are modified or added. I want to Display the simple XML data in a List which is refreshed automatically after one minute to reflect the changes. I am a newbie and i have very little knowledge about Flex so please Give me some code snippet so that i could run it and get some idea.
Load Dynamic (constantly changing) XML Data to List in Flex

[Action Script] [AS3] Hittest works in flash, but not in browser May,2012

I have 2 games that have the same problem. When I test them in Flash, everything works as it is supposed to. When I upload them to a website, some of the hittests does not work. You can go through the walls, but you can still collect the rewards. So hittest works sometimes.

Check it out, it's the bottom 2 games: simcoesabres (dot) com/index.php?option=com_content&view=article&id=1037& Itemid=755
[AS3] Hittest works in flash, but not in browser

[Action Script] Socket or XMLSocket? May,2012

Hi, I'm building an AIR application with Action Script.
The goal is to send a request from device A to device B and receive it as push notification on this one.
I have already set the notification but I don't know how to make the connection between devices.
I thought about something like chat or general instant messaging and I bumped into Socket and XMLSocket solution.
I found other possibilities but it's the first time I face this kind of functionality and I please ask your advice about the best (and easiest) way to do this.

I also tried to set an XMLSocket connection to send data from device A but I don't know how to take the data from server to device B because I'm just a beginner in php language and I don't know Java or other languages at all.

Hope someone can help me asap. :confused:
Thanks
F.
Socket or XMLSocket?

[Action Script] AS2 swf file to play on android May,2012

can be played on any handheld devices? like android and how? can someone help me for an easier way
AS2 swf file to play on android

[Action Script] [AS3] how to track the lives in the game May,2012

Hi I''m learning AS3 and I'm doing a flash AS3 game for my class. I do not know how to track the lives in the game.
This is my code:

var isJumping:Boolean;
var landID:int;
var gameSpeed:int;
var lives:int;
var deathFlashTimer:Timer;
var barrelOneClips:Array;
var barrelTwoClips:Array;
var barrelThreeClips:Array;
var barrelThrowerID:int;//Store the set interval
var barrelMoverID:int;//move all teh barrels
var score:int;


function init () :void {
isJumping=false;
gameSpeed=1000;
//500 is half of a second
stage.addEventListener(KeyboardEvent.KEY_UP,onKeyR eleased);


lives=3;
lives_mc.gotoAndStop(lives+1);

barrelOneClips=new Array();
barrelTwoClips=new Array();
barrelThreeClips=new Array();

deathFlashTimer=new Timer(gameSpeed,6);
deathFlashTimer.addEventListener(TimerEvent.TIMER_ COMPLETE,loseLife);

barrelThrowerID=setInterval(trowBarrel,gameSpeed);
barrelMoverID=setInterval(moveAllBarrels,gameSpeed );

score=0;
updateScore(0);


}
init();
function onKeyReleased(e:KeyboardEvent):void{
if (!isJumping) {
switch(e.keyCode) {
case Keyboard.UP:
char_mc.gotoAndStop(char_mc.upFrame);
break;

case Keyboard.DOWN:
char_mc.gotoAndStop(char_mc.downFrame);
break;

case Keyboard.LEFT:
char_mc.gotoAndStop(char_mc.leftFrame);
break;

case Keyboard.RIGHT:
char_mc.gotoAndStop(char_mc.rightFrame);
break;

case Keyboard.SPACE:
if(char_mc.canJump){
jumpChar();
}
char_mc.frame_mcwaiter.gotoAndPlay("jump");
break;

}

}

}
function jumpChar():void{
isJumping=true;
char_mc.frame_mcwaiter.gotoAndPlay ("jump");
landID=setTimeout(landChar,gameSpeed);

}

function landChar():void{
isJumping=false;
char_mc.gotoAndStop(11);
clearTimeout(landID)
}


function resetGame(e:TimerEvent=null):void{
char_mc.gotoAndStop(1);
landChar();
//deathFlashTimer.reset();


var i:int;
var b:MovieClip;
for(i=barrelOneClips.length-1;i>0;i--){
b=barrelOneClips[i];
removeChild(b);
barrelOneClips.splice(i,1);
}

for(i=barrelTwoClips.length-1;i>0;i--){
b=barrelTwoClips[i];
removeChild(b);
barrelTwoClips.splice(i,1);
}

for(i=barrelThreeClips.length-1;i>0;i--){
b=barrelThreeClips[i];

if(b.currentFrame==b.totalFrames){
removeChild(b);
barrelThreeClips.splice(i,1);
}
}
resumeGame();


}

function pauseGame():void{
stage.removeEventListener(KeyboardEvent.KEY_UP,onK eyReleased);
clearInterval(barrelThrowerID);
clearInterval(barrelMoverID);


}


function resumeGame():void{
stage.addEventListener(KeyboardEvent.KEY_UP,onKeyR eleased);
barrelThrowerID=setInterval(trowBarrel,gameSpeed);
barrelMoverID=setInterval(moveAllBarrels,gameSpeed );

}

function loseLife(e:TimerEvent):void {

lives--;
lives_mc.gotoAndStop(lives+1);
if (lives>0) {
resetGame();

}

}

function trowBarrel():void{

var chance:int=Math.ceil(Math.random()*2)
if (chance==1){

var which:int=Math.ceil(Math.random()*3)
var newBarrel:MovieClip;
if(which==1){
newBarrel=new Barrel1();
barrelOneClips.push(newBarrel);
newBarrel.x=241.75;
newBarrel.y=433.95;
}if(which==2){
newBarrel=new Barrel2();
barrelTwoClips.push(newBarrel);
newBarrel.x=339.75;
newBarrel.y=131.45;
}if(which==3){
newBarrel=new Barrel3();
barrelThreeClips.push(newBarrel);
newBarrel.x=663.75;
newBarrel.y=133.45;

}


addChild(newBarrel);
}


}

function moveAllBarrels():void{
var i:int;
var b:MovieClip;
for(i=barrelOneClips.length-1;i>0;i--){
b=barrelOneClips[i];
b.gotoAndStop(b.currentFrame+1);
if(b.currentFrame==b.totalFrames){
removeChild(b);
barrelOneClips.splice(i,1);
}
}
for(i=barrelTwoClips.length-1;i>0;i--){
b=barrelTwoClips[i];
b.gotoAndStop(b.currentFrame+1);
if(b.currentFrame==b.totalFrames){
removeChild(b);
barrelTwoClips.splice(i,1);
}
}
for(i=barrelThreeClips.length-1;i>0;i--){
b=barrelThreeClips[i];
b.gotoAndStop(b.currentFrame+1);
if(b.currentFrame==b.totalFrames){
removeChild(b);
barrelThreeClips.splice(i,1);
}
}
if(checkBarrelMoveHit()){
updateScore(5);
}
if(checkBarrelMoveHit()==false){
charDied();
}



}

function checkBarrelMoveHit ():Boolean{
var i:int;
var b:MovieClip;
//barrel (1)
for(i=barrelOneClips.length-1;i>0;i--){
b=barrelOneClips[i];
switch(char_mc.currentFrame){
case 4://character 1st level
if(b.currentFrame==9){
return true;
}
break;

}
}

//barrel (2)
for(i=barrelTwoClips.length-1;i>0;i--){
b=barrelTwoClips[i];
switch(char_mc.currentFrame){
case 9://character 2nd level
if(b.currentFrame==6){//chili
return true;
}
break;

}
}
//barrel (3)
for(i=barrelThreeClips.length-1;i>0;i--){
b=barrelThreeClips[i];
switch(char_mc.currentFrame){
case 10://character 3rd level
if(b.currentFrame==6){//chili
return true;
}
break;

}
}
return false;
}


function updateScore(amount:int):void{
score+=amount;
score_txt.text="SCORE: "+score;
}
function charDied():void {
deathFlashTimer.start();
}
[AS3] how to track the lives in the game

[Action Script] How to trace file's last modified date in as3 May,2012

Is there any method in as3 that flash can write file's last modified date.

Its stand alone flash application which had external swf loading. I want to check the last modified date of the swf during the loading. please suggest any possible methods. Thanks.
How to trace file's last modified date in as3

Tuesday, May 29, 2012

[Action Script] 64 bit unsigned integer May,2012

I KNOW adobe air 3 has a 64 bit option on its install
so its HAS to have a 64 bit integer
So how do I make one and target the specific bits?
I know I've asked this about a thousand times but I never came to a solution

Remember not 4294967295
18446744073709551615
64 bit unsigned integer

[Action Script] Parsing external text file May,2012

Hi all,

I'm quite new to ActionScript... and coding in general. I know HTML, and I can google my way to magical formulas in excel... so please bare with me :)

I'm trying to use an external text file to define image filenames to pull into movie clips. The idea is that I can create a site for someone, and they can change what is displayed by editing the text file.

I have everything working now... but my .txt file is messy and I would like it to be easy to read/edit for the person I'm giving it to.

Currently it looks like:
&pic1=prod1.png&pic2=prod2.png&pic3=prod3.png&pic4 =prod4.png&pic5=prod5.png&EOF=true

I want it to look like:
&pic1=prod1.png
&pic2=prod2.png
&pic3=prod3.png
&pic4=prod4.png
&pic5=prod5.png
&EOF=true

I've tried a few "remove newline or carriage return" functions floating around google, but they don't work for me. This could be because they're for something else and I don't understand them, or it could be that I'm not putting them where I need to.

Anyone able to give me a hand?

Thanks!
WillBreezy
Parsing external text file

[Action Script] Dynamic Mask May,2012

I'm creating an application that loads the newest videos from a specified YouTube channel. It grabs the title, description, comments, views, thumbs up/down, and a URL to the thumbnail. It loads everything about 12 times and all of this data is stored in an array according to what it is (ex: videoThumb string goes into the array videoThumbArray). What I'm doing now is loading the thumbnail URL and adding it to the stage. I want the thumbnail to have rounded edges, so I create a mask using the Shape class built into Flash.


Here is my code for that specific function:
ActionScript Code: var thumbLoader:Loader = new Loader();thumbLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, thumbLoaded);thumbLoader.load(new URLRequest(videoThumbArray[currentThumb]));        function thumbLoaded(e:Event):void    {        var bubbleMask:Shape = new Shape();        bubbleMask.graphics.beginFill(0x006600, 1);        bubbleMask.graphics.drawRoundRect((91 - (104/2)), (20 + (160 * (currentThumb + 1)) - (104/2) - 4.3), 104, 104, 17, 17);        bubbleMask.graphics.endFill();        bubbleArray[currentThumb].addChild(bubbleMask);                thumbLoader.width = 104;        thumbLoader.height = 104;        thumbLoader.x = 91 - (thumbLoader.width / 2);        thumbLoader.y = (20 + (160 * (currentThumb + 1))) - (thumbLoader.height / 2) - 4.3;        thumbLoader.mask = bubbleArray[currentThumb].bubbleMask;                bubbleArray[currentThumb].addChild(thumbLoader);    }
It creates the mask and it loads the image, but it doesn't appear to apply the mask to the thumbnail. I can't tell what I'm doing wrong.

Any help is appreciated!

Thanks,
Jacob
Dynamic Mask

[Action Script] whats is this code and how can i edit this function May,2012

pls help me whats is this code and how can i edit this function () {
\x03 = 2315 % 511 * true;
return (eval("\x03"));
} // End of the function
var \x01 = 443 + \x04\x05();
for (\x01 = eval("\x01") - 171; eval("\x01") == 372; \x01 = eval("\x01") + 30) {
} // end of for
if (eval("\x01") == 538) {
\x01 = eval("\x01") - 140;

}
else {
\x01 = eval("\x01") + 84;
var null = true;
\x01 = eval("\x01") + 122;
\x01 = eval("\x01") + 101;
if (eval("\x01") == 992) {
\x01 = eval("\x01") - 454;

} // end if
if (eval("\x01") == 774) {
\x01 = eval("\x01") + 218;
if (!"\x0f") {
}
else {
\x01 = eval("\x01") - 454;
} // end else if

} // end if
if (eval("\x01") == 709) {
\x01 = eval("\x01") - 261;

} // end if
if (eval("\x01") == 394) {
\x01 = eval("\x01") + 8;

} // end if
if (eval("\x01") == 398) {
\x01 = eval("\x01") - 398;

} // end if
if (eval("\x01") == 448) {
\x01 = eval("\x01") + 326;

} // end if
if (eval("\x01") == 427) {
\x01 = eval("\x01") - 33;


} // end if
if (eval("\x01") == 543) {
\x01 = eval("\x01") - 116;
if (eval("1")) {
}
else {
\x01 = eval("\x01") - 33;
} // end else if

} // end if

} // end else if

[Action Script] LoadVariables in external swf not working on web server May,2012

Hello

I have a main swf movie which has a movie clip place holder called "device_properties". I also have external swf movie clips that have "loadvariable" actionscript interfacing with an .asp page.

The external swf movie clips are loaded into the movie clip place holder ("device_properties") of the main swf by a "loadmovie" actionscript command attached to a button.

**The following is the actionscript for the button in the main swf:

on (release) {
loadMovie("swf/12vps_1.swf", "device_properties");
}


**The following is the actionscript for the external swf movie with the loadvariables:

onClipEvent (data) {
strDevice_Label = Device_Label;
strID = ID;
strDevice = Device;
strDevice_Description = Device_Description;
strManufacturer = Manufacturer;
strModel = Model;
strLocation = Location;
strTotal_Amps = Total_Amps;

}

onClipEvent (load) {

loadVariables("../../db/001_12vps_1.asp?", this);

}


If I open the external swf movie by itself (on the web server), the variables are loaded and displayed in the dynamic text fields just fine..But when I load the same external swf movie into the the movie clip place holder ("device_properties") of the main swf by clicking the button (once again from the web server) the variables are not displayed...

Any help would be greatly appreciated!
LoadVariables in external swf not working on web server

[Action Script] Actionscripts like animoto May,2012

I'm new to this forum and forgive me if I'm asking something that may be ridiculous.

Is there a site or place where I can download actionscipts that do what animoto.com does with images and videos. It could be a set of scripts that do the individual things like cut up the pictures, move them around, make a filmstrip out of them, etc or perhaps one script that does this either randomly like animoto or with me assigning certain values.

Thank you in advance. Any help or suggestions will be sincerely appreciated.
Actionscripts like animoto

Monday, May 28, 2012

[Action Script] Problem with connection string in visual studio 2010!!!!! May,2012

hello
i am working on a website..using ASP.net 4.0 and C#.
everything with the designing and layouts is done so i shifted my focus on the database thing and the first day has been the longest yet..
i also have the MS SQL Management server 2008 R2 installed as windows authentication but im not using that.
I am using the inbuilt database service in the visual studio 2010.
what i did was that..
First i created a database by going to "ADD NEW ITEM" and then selecting the "SQL DATABASE SERVER" , inamed it DNS.
the database got created fine. I added some tables and content to it. I the dragged the table in my content place holder and the gridview was fine..when i run the page, the data is displayed fine in the gridview.
The problem is that i am not able to get data into the database..the connection srting seems wrong, my connection string is

Code: SqlConnection con = new SqlConnection("Server=VISHAL-PC;Database=DNS;Integrated Security=True;");Also in the properties of my database connection string is different..here it is

Code: Data Source=.\SQLEXPRESS;AttachDbFilename="E:\Programing\Projects\DNS Site 2\App_Data\DNS.mdf";Integrated Security=True;User Instance=Truehere the server is displayed ".\SQLEXPRESS" but if i write that in my connection string then it shows a red line under the ".\" part and also in the file path.
Even if i dont use the file path and give the database name DNS and server name as SQLEXPRESS then also error occurs at my connection object con.

This is the error i get
Code: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)he error is shown here:
Code: SqlConnection con = new SqlConnection("Server=VISHAL-PC;Database=DNS;Integrated Security=True;");
    SqlDataAdapter da;
    DataSet ds = new DataSet();


    protected void Page_Load(object sender, EventArgs e)
    {

    }
   
   
   
    protected void Button1_Click(object sender, EventArgs e)
    {
        DataSet ds1 = new DataSet();
        SqlCommand cmd = new SqlCommand("Insert into Registration values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" +        TextBox5.Text + "','" + TextBox6.Text + "','" + TextBox7.Text + "','" + TextBox8.Text + "','" + TextBox9.Text + "','" + TextBox10.Text + "','" + TextBox11.Text +            "','" + TextBox12.Text + "','" + TextBox13.Text + "','" + TextBox14.Text + "',),con");
        con.Open();
        cmd.ExecuteNonQuery();
        con.Close();
       
        Response.Write("Data Saved Sucessfully");
       


    }..Here is the code from my web.config <connectionstring>
Code: <connectionStrings>
  <add name="DNSConnectionString1" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\DNS.mdf;Integrated Security=True;User Instance=True"
  providerName="System.Data.SqlClient" />
 </connectionStrings>im unable to get my connection string..please help me guys..i just have 2-3 days!!
Problem with connection string in visual studio 2010!!!!!

[Action Script] MouseEvent works only once May,2012

Hi
Can someone please tell me why my MouseEvent only works the first time and after that it doesnt work anmore

Here's the code:

ActionScript Code: btn_start.addEventListener(MouseEvent.CLICK, startTheGame);                    }                function startTheGame(event:MouseEvent):void        {            trace("Start");            gotoAndStop(2);        }
thanks!

btn_start starts the game.
when the game is over (the player lost all his lives) I go to Frame 1 (this is where my start-button is) but the button doesnt work anymore.
MouseEvent works only once

[Action Script] flash menu for playing swf animations.. May,2012

Hello friends...
I am looking for a menu, in order to get together and play bunch of .swf animations.

I have lesson animations, physics, mathematic and chemistry.

I have 20 physics .swf animations.

When I run physics flash menu, its interface will show the 20 animations. When user choose the related .swf animation, then it will play it.

Is there any open source menu application for it?

Any help, idea will be very helpful

I am waiting..
flash menu for playing swf animations..

[Action Script] Internet radio player May,2012

Hello
I am trying to make an internet radio player with Flash.
I am using this code:
ActionScript Code: var my_sound:Sound = new Sound();my_sound.loadSound("URL_here", true);
The problem is that, some of the stations/url-s work and some of them wont work.
For example this is working fine:
ActionScript Code: var my_sound:Sound = new Sound();my_sound.loadSound("stream05.akaver.com/skyplus_hi.mp3", true);But this one is not working:
ActionScript Code: var my_sound:Sound = new Sound();my_sound.loadSound("83.145.249.104", true);
I tried "Native flash Radio", and with that the other url worked also. So I guess I am doing something wrong here.
Here is my fla: kkert.planet.ee/stuff/radio.fla
Here is the swf sample: kkert.planet.ee/raadiotest/test2.html
And here is the "Native flash radio" with the same url working: kkert.planet.ee/raadiotest/example.html

PS: I had to remove the http stuff from links, becuse I cant post links before I have 50 posts.
Internet radio player

[Action Script] Making objects shake May,2012

Hi,

I need some help adding shake or jiggle to the objects I have displayed on stage.

Here is the code I need to work around:

Quote: var myRound:Circle;

for(var i:Number=0; i<200; i++)
{
myRound = new Circle();
addChild(myRound);

var randomValue:Number = Math.random()*1;

myRound.x = -100+Math.random()*500;
myRound.y = -100+Math.random()*400;

myRound.scaleX = myRound.scaleY = randomValue;
myRound.alpha = 1-randomValue;
}



Making objects shake

[Action Script] Simple button actionscript May,2012

Hi, everyone.

I want to create a button which is:
1. at first, when i click the orange button, all bars on the field come out.
2. then when all bars have came out, when i click the orange button again, the black and cyan bars shrink out except for the blue and red bars (both still on the field).
3. then when the black and cyan bars have shrunk out, when i click the orange button again, the black and cyan bars come out again like before, and the blue and red bars still there.
4. it continuously repeat step 2 and to 3 with blue and red bars still on the field.

Difficult to understand? (bad explanation, apologize) :p
go to this url: (don't forget the dots)
wwwfiledencom/files/2008/6/1/1939635/Untitled-2.swf

I guess this is simple for you, so please respond quickly! :)
Thank you!
Simple button actionscript

Sunday, May 27, 2012

[Action Script] Add variable in quotes May,2012

I can add variable in this script very well,
HTML Code: getURL("actionscript"+a+".org");But in this script,
HTML Code: getURL("javascript:launch('actionscript'+a+'.org')");Thats didn't work. Why?
Add variable in quotes

[Action Script] text search engine as 3.0 May,2012

hello all
i am currently developing a mobile app and i am having a problem of applying the text search engine code
my search engine is on my first page
and the keywords i want to search are not in the same page

anybody helps?>__<!!!
:confused:
text search engine as 3.0

[Action Script] removing objects from memory May,2012

is the below enough to remove the movie on currentPage from memory via the null value? My aim is to remove the movie from memory after being removed from contentMc?? ActionScript Code: if (currentPage && currentPage.parent) contentMc.removeChild(currentPage);         currentPage = null;         //trace(contentMc.numChildren, currentPage);        currentPage = contentMc.addChild(pages[btns.indexOf(e.currentTarget)]);        //trace(contentMc.numChildren, currentPage);
removing objects from memory

[Action Script] Does extends also mean implements? May,2012

Hi all,

Suppose you have the following:

ActionScript Code: public interface IFoo{    function someFunc():void}public class Foo implements IFoo{    public function someFunc():void    {        // do something...    }}public class Bar extends Foo{    //...someFunc() is inherited, but is IFoo implemented?}
Since Bar extends Foo, does that mean Bar also implements IFoo? I think I remember reading (possibly in Essential ActionScript) that the answer is no, but I can't remember where (and Google's not helping).

Thanks,
Rob
Does extends also mean implements?

[Action Script] Casting an Object? May,2012

I remember reading a long time ago that when one wishes to give an instance a different class for whatever reason, it's called casting... at least I think so.

Anyways, I'm new here. Hello All. :) And I'm already encountering some difficulties. This one is one that I simply do not know how to fix.

The Attractor class is extended from MovieClip. There is an attractor instance as a child of the stage named "attractor".

Code: if (stage.getChildByName("attractor") != null)
                        {
                                var attractor:Attractor = (stage.getChildByName("attractor"));
                        }The problem with this is:
Code: Implicit coercion of a value with static type flash.display:DisplayObject to a possibly unrelated type Attractor.I can't afford to just make the variable type Object, because I'm going to use the reference as an argument in other methods.

Can anybody tell me how to fix this? I'm sure it's an easy fix. I substantially cleaned the code, if you need to see more just say.
Casting an Object?

[Action Script] Opening PDF May,2012

Hi guys,


I having some issue opening URL or PDF in AS3. I just use the code snippets for do this:

ActionScript Code: /* Click to Go to Web PageClicking on the specified symbol instance loads the URL in a new browser window.Instructions:1. Replace url with the desired URL address.   Keep the quotation marks ("").*/manual939.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPage);function fl_ClickToGoToWebPage(event:MouseEvent):void{    navigateToURL(new URLRequest("manual.pdf"), "_blank");}
The pdf and fla/swf is under the same directory (folder). But this is the error I got:


ActionScript Code: TypeError: Error #2007: Parameter url must be non-null.    at global/flash.net::navigateToURL()    at main_fla::main_43/opencloseclick()

Any idea?
Thanks in advance.
Opening PDF

Saturday, May 26, 2012

[Action Script] Accessing function in MovieClip May,2012

Hey there,

I have a question regarding the access of functions in a Movieclip. Its probably a noob question, since I am still new to AS2 but here we go:

I am adding a new ui element to my stage like this:

ActionScript Code: var new_item:MovieClip=this.createEmptyMovieClip(item_name,this.getNextHighestDepth());new_item.attachMovie("InventorySlot",item,this.getNextHighestDepth());
The class I am using is "InventorySlot". This works well and I get the the new clip on the stage and can use it. However I have no idea what the syntax woudl be to access functions from the class the clip is using.
The function I would like to call is defined in the InventorySlot.as:

ActionScript Code: public function updateContent() {        trace("Test");}
I was trying to call it with "new_item.updateContent();" but that doesn't seem to work.
Any help on this would be appreciated.
Accessing function in MovieClip

[Action Script] Problem with class definitions May,2012

Hello , I'm with a problem in class definition . The compiler presents the following errors :
...\Welcome.as(23): col: 4 Error: The private attribute may be used only on class property definitions.
...\Welcome.as(30): col: 4 Error: The public attribute can only be used inside a package.
...\Welcome.as(57): col: 4 Error: The public attribute can only be used inside a package.

I use the last version of the FlashDevelop, FP 11.2 , and AIR 3.2...

What the problem?
Thanks advance...

The code is the follow:

ActionScript Code: package screens {    import starling.display.Button;    import starling.display.Image;    import starling.display.Sprite;    import starling.events.Event;        public class Welcome extends Sprite     {        private var bg:Image;        private var title:Image;        private var hero:Image;                private var playBtn:Button;        private var aboutBtn:Button;                        public function Welcome()         {            //super();            this.addEventListener(starling.events.Event.ADDED_TO_STAGE, onAddedToStage);                        private function onAddedToStage(event:Event):void             {                trace ("WelcomeScreen to initialized");                                drawScreen();            }                        public function drawScreen():void            {                bg = new Image(Assets.getTexture("BgWelcome"));                this.addChild(bg);                                title = new Image(Assets.getTexture("WelcomeTitle"));                title.x = 440;                title.y = 20;                this.addChild(title);                                hero = new Image(Assets.getTexture("WelcomeHero"));                this.addChild(hero);                hero.x = -hero.width;                hero.y = 100;                                playBtn  = new Button(Assets.getTexture("WelcomePlayBtn"));                this.addChild(playBtn);                playBtn.x = 500;                playBtn.y = 260;                                aboutBtn = new Button(Assets.getTexture("WelcomeAboutBtn"));                this.addChild(aboutBtn);                aboutBtn.x = 410;                aboutBtn.y = 380;                                            }                        public function initialize():void                  {                this.visible = true;                                hero.x = -hero.width;                hero.y = 100;            }        }    }}
Problem with class definitions

[Action Script] In-App debug info? May,2012

I need to test an AIR app on another person's computer (in another city). They're not an engineer, so they can't run the profiler.

Is there a way to get system information from within the app?
I thought that Capabilities would have something but not.

I need memory usage, what other apps are running, stuff like that... to be able to display it in-app, or write it to a file that the tester can send me.

Is this possible?
In-App debug info?

[Action Script] Changing "y" value of yoyo tween May,2012

I have buttons set on yoyo like so:

var myTween1 = new Tween(upClose.buttonOne, "y", Regular.easeInOut, 100, 115, 1.3, true);
myTween1.addEventListener(TweenEvent.MOTION_FINISH , onFinish1);
function onFinish1(e:TweenEvent):void{
myTween1.yoyo();
}

At some point, I have to change the y values of this yoyo tween.
I tried mytween1.stop(); and then write another function with different y values but it just stops the previous tween and doesn't create a new one.
I know there must be a way to simply change the y values in the existing function...Or do I have to kill the first one first and if so, how?
HELP
Thanks.
Changing "y" value of yoyo tween

[Action Script] [AS3] sync problems and auto refresh swf? May,2012

any of you flash gurus know how to solve the sync problem fms flash streams have?

adobe.com/devnet/flashmediaserver/articles/beginner_live_fms3.html

like a script to refresh the swf every 10 minutes so everyone can stop f5ing.

please help, anyone.
[AS3] sync problems and auto refresh swf?

[Action Script] Lag in simple animation May,2012

I have a simple loading screen that I show by using mc.visible=true;

Inside this movieclip is a simple timeline animation that shows 6 very small pngs in sequence. PNG1 is shown for 5 frames, then PNG2 and so on...

I have a couple loading processes happening in the background... When I set the loading movieclip to visible=true, the animation freezes on frame 1 for Approx 3 seconds.

When I use a profiler my framerate stays at 60fps without a dip.

Is there a more lightweight way to do this to avoid the lag ?
Lag in simple animation

Friday, May 25, 2012

[Action Script] How to update and save xml file May,2012

Hi,
I am updating my xml file by appending some new set of nodes into it at run time. How do i save the XML file. Does flash update and save the existing XML file which is loaded into flash or I need to save it as new a file. But i want to save the new nodes into the existing XML.
Please help me. Thanks.
How to update and save xml file

[Action Script] Security Sandbox Violation? May,2012

I'm trying to draw a section of my app's screen, but because sections of it use Netstream I'm getting this error:

Code: SecurityError: Error #2123: Security sandbox violation: BitmapData.draw: file:////GRAYLE/Nexstar/No%20Background/final.swf cannot access null. No policy files granted access.
        at flash.display::BitmapData/draw()
        at final_fla::MainTimeline/captureFrame()
        at final_fla::MainTimeline/startRecording()
        at final_fla::MainTimeline/setState()
        at final_fla::MainTimeline/rec_btn_click()Ive done a bit of research and found a few snippets of code that mention this error coming out when the movie being netstreamed hasn't finished loading yet. So I modified my code to this:

ActionScript Code: var fgvid:Video = new Video(320, 240);            fgvid.x = 14;            fgvid.y = 45;            captureScreen.addChild(fgvid);            var fgnc:NetConnection = new NetConnection();            fgnc.connect(null);            var fgns:NetStream = new NetStream(fgnc);            fgvid.attachNetStream(fgns);            var fglistener:Object = new Object();            fglistener.onCuePoint = function(e:Object):void {};            fglistener.onMetaData = function(e:Object):void {};            fgns.client = fglistener;            switch(event.currentTarget.video_label_txt.text){            case "Fire Wedge":            fgns.play("foreground/fire_wedges.flv");            break;                        case "Blue Spiral":            fgns.play("foreground/blue_spiral.flv");            break;            }                        fgns.addEventListener(NetStatusEvent.NET_STATUS, fgNetStatusHandler);            fgns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);            function fgNetStatusHandler( event:NetStatusEvent ) :void            {                if(event.info.code == "NetStream.Play.Stop")                fgns.seek(0);            }            function asyncErrorHandler(e:AsyncErrorEvent):void {}        };
So far, still no joy. I have the bitmapdraw code attached to a button inside the stage. Could any of you experts help a clueless guy like me? :confused:
Security Sandbox Violation?

[Action Script] vertical pictures slideshow May,2012

Hello Everybody.

Im desperate to find a tutorial how to do a vertical picture slideshow. I imagine that you fx have 20 pictures, and those 10 pictures slide vertical to the next picture.

Does anyone have a tutorial who can do that?

I hope you can help me?

Best Regards
Mads
vertical pictures slideshow

[Action Script] how to removeEventListener from XML buttons May,2012

hi ppl i have this

Code: var xmlGeneracijaLoad:URLLoader = new URLLoader;
var xmlGeneracijaRequest:URLRequest = new URLRequest( urlGeneracije );
xmlGeneracijaLoad.load( xmlGeneracijaRequest );

xmlGeneracijaLoad.addEventListener( Event.COMPLETE , sortirajGeneracije );

function sortirajGeneracije(event:Event):void {
                var generacijeXML:XML = new XML( xmlGeneracijaLoad.data );

        var xmlGenBtn:btnGeneracije;
       
        var i:uint = 0;

        for each (var page:XML in generacijeXML.generacije.generacija) {
               
                xmlGenBtn = new btnGeneracije();       
               
                xmlGenBtn.btnGenText.text = page.@name;

                xmlGenBtn.source = page.source.toString();

                xmlGenBtn.btnGenText.autoSize = TextFieldAutoSize.LEFT;

                xmlGenBtn.x = 5 + i*155;
                xmlGenBtn.y = 5;

                xmlGenBtn.buttonMode = true;
                xmlGenBtn.mouseChildren = false;
               
                xmlGenBtn.addEventListener(MouseEvent.MOUSE_DOWN , onMouseDownHandler);
               
                addChild(xmlGenBtn);

                i++;       
        }
function onMouseDownHandler(event:Event):void {       
                        var mouseDownHandler:btnGeneracije = event.target as btnGeneracije;
                        var newUrlRequest:URLRequest = new URLRequest(mouseDownHandler.source);
                       
}now i want to removeEvent listener from current btn until i clicked on other button , i dont want that current button be clicked all time if u clik 1 time u cant click on it until u click on other
any help?
how to removeEventListener from XML buttons

[Action Script] Please Review New E-Commerse Website!! May,2012

Hi Friends,

Please review my new site maxima-comunicazione.it.We design many ecommerce site, leaflets, brochures and creates different types of attractive logo,sitemap at reasonable price.We also advertise your website by differente modern technique.
Please Review New E-Commerse Website!!

[Action Script] Dynamic Shared library class May,2012

Hi,
This can be useful

ActionScript Code: package {        import flash.display.LoaderInfo;    import flash.display.Loader;    import flash.display.MovieClip;    import flash.net.URLRequest;    import flash.events.Event;    import flash.events.EventDispatcher;    public class library extends EventDispatcher {        public static var $assets:LoaderInfo;        public function library(url:String):void {            var request:URLRequest = new URLRequest(url);            var loader:Loader = new Loader();            loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaded);            loader.load(request);        }        private function onLoaded(e:Event):void {            $assets = LoaderInfo(e.target);            dispatchEvent( new Event("ON_LIBRARY_LOADED"))        }        public static function getElement(id:String):MovieClip {            var src = $assets.applicationDomain.getDefinition(id) as Class;            return MovieClip(new src());        }            }}var myLibrary:library = new library("assets.swf");myLibrary.addEventListener("ON_LIBRARY_LOADED", InitializeStage)public function InitializeStage(e:Event) {    var sqr= library.getElement("sqr_mc");    addChild(sqr)}
Dynamic Shared library class

Thursday, May 24, 2012

[Action Script] problem with root & function May,2012

hi ppl
i have problem when i call root from linkage button

on mainstage i have

function firstFunction():void {

var basename:String = "pictureNumber";

}
and in linkege button have code on click to trace
trace (basename);
insted i got mesage pictureNumber i got "Variable basename is not defined."
when i do this
basename = root.basename;
i got mesage "undefined"

any help ?
problem with root & function

[Action Script] YouTube video in iOS May,2012

I'm creating an app that loads the 15 newest videos from a specified channel and loads information about that video. When the user taps on a specific cell from a list, it will navigate to ("http://youtube.com/watch?v=" + videoID).

I was looking into how I can load that video and play it in my app using the native video player and not having to go into the Safari / YouTube application.

Any ideas?

Thanks!
Jacob
YouTube video in iOS

[Action Script] how can I reference a movieclip that is on the stage from a class? May,2012

Ok, I have a quick question.
how can I reference a movieclip that is on the stage from
a class?

Thanks,
-James
how can I reference a movieclip that is on the stage from a class?

[Action Script] programming Accelorometer May,2012

Hi guys, I am trying to create an application by using Flash CS6 with accelorormeter code. The Flash has component with programming a ball movement. But I want to be able to trigger the ball to do the multiple animation movement instead just a still image, how can I do it? Someone who can help me will be so wonderful. Thank you
programming Accelorometer

[Action Script] How to make a function with infinite parameters? May,2012

I want to make a function that can hold infinite parameters.
Like how trace() can go on forever.

Is there a way to do this?
How to make a function with infinite parameters?

[Action Script] How To add frames on stage? May,2012

I have a frame called City.It contains the buildings of the player.I want to add a frame called the world.When the player presses the world button,the game will load frame world.Players can add cities in the world.
How to add frame on stage and add movieclips on this frame?
How To add frames on stage?

Wednesday, May 23, 2012

[Action Script] Removing arrays when character walks over switch. HELP. May,2012

Hi guys, I'm quite new to Arrays so I don't know if I'm doing this right
Basically when the character walks over a detonator, the detonators array is removed ,and the dynamites array should be removed also.
The issue I find is that, the array for the detonator is removed when it is walked over, but the image is not removed, and also when the detonator is walked upon, the dynamite array and image are not removed either
Here is the code so far:

for (var d =0; d<detonators.length;d++){
if (koala[k].hitTestObject(detonators[d])){
removeChild(detonators[d]);
removeChild(dynamites[j]);
detonators.splice(d,1);
dynamites.splice(j,1)
dynamites[j].removeEventListener(Event.ENTER_FRAME, moveDynamite);
detonators[d].removeEventListener(Event.ENTER_FRAME, moveDetonator);
trace('detonators' +detonators.array)
Removing arrays when character walks over switch. HELP.

[Action Script] Drag and Drop issue May,2012

Hi!
I ran into a little problem while creating this simple Drag and Drop game

ActionScript Code: stop();button.onPress = function(){    he.attachMovie("att", "att2", this.getNextHighestDepth());    he.att2.startDrag(true);    he.att2._xscale = 25;    he.att2._yscale = 25;}button.onRelease=button.onReleaseOutside=function(){he.att2.stopDrag(true);}he.att2.onPress = function(){    this.startDrag(true);}
How come i can't use this to drag the movieclip again, after releasing it?
Drag and Drop issue

[Action Script] Components question May,2012

Hi all ,

I have a really basic question. I have a class and I have created a component using the meta tags. Now I want to extend this component class into another component with additional features and functionalities.

But when I just extend the class the child Class doesn't retain the meta tag data and there is also problems accessing the protected variables of the base class. Im not sure if I am missing something here or if there is get around to this problem.

Cheers
Components question

[Action Script] Cannot access a property or method of a null object reference. May,2012

So I'm making an mmo game and I cannot figure this out.

Code: protected function updateUserList ():void {
                        userlist.text = "";
                        for each (var client:IClient in chatRoom.getOccupants()) {
                                userlist.appendText(parseUsername(getUserName(client)));
                        }
                }

protected function chatMessageListener(fromClient:IClient, messageText:String):void{                       
msg.displayChatMessage(parseUsername(getUserName(fromClient)), Rank.USER, messageText);
                       
                }

protected function parseUsername(parseName:String):String               
                {
                        parseName = parseName.replace("[USER_ACCOUNT userid: ", "");
                        parseName = parseName.replace(",", "");
                        var parse:Array = parseName.split(" ");
                        parseName = parse[0];
                        return parseName;
                }TypeError: Error #1009: Cannot access a property or method of a null object reference.
at pages::lobbyP/parseUsername()
at pages::lobbyP/chatMessageListener()

The null object references appear in the chat message listener and user list listener.

Thanks for the help.
Cannot access a property or method of a null object reference.

[Action Script] I want to update my flash data for a give time May,2012

Hi all,

I want to update my flash data for a give time... can it be possible ..
can u please provide me a small peace of code how to do it..
I want to update my flash data for a give time

[Action Script] Sending var from document class to subclass? May,2012

Probably the noobest question ever, how to send a variable from the document class to a different class?
I tried using
Public var blah:Number;
...
blah=1
And on the other class I attempted calling the variable but it was just a null object.
Sending var from document class to subclass?

Tuesday, May 22, 2012

[Action Script] text in the loop May,2012

How do I include the following in a loop?

this["List" + i] = "C" + i + "_5_Ans.split(" ??? How to indicate quotes?

List1 = C1_5_Ans.split("\r");
List2 = C2_5_Ans.split("\r");
List3 = C3_5_Ans.split("\r");
List4 = C4_5_Ans.split("\r");
...

Thanks for the help,
text in the loop

[Action Script] FMS "broadcastMsg" only to 1 client. May,2012

Hey guys!
I am not really sure how to implement the following:

I need to broadcast a message only to a specific client, not to all clients connected to an application instance, any ideas on how that can be
accomplished???

Code: application.broadcastMsg()
//Broadcasts a message to all clients connected to an application instance.Thanks in advance!!
FMS "broadcastMsg" only to 1 client.

[Action Script] 2D array problem May,2012

I have the code:


Code: var blockmanager:Array = new Array() Code: blockmanager[0] = new Array()
Code: blockmanager[0].push(block.x)
blockmanager[1].push(block.y)...to add some block positions (x,y) to this 2D array. First of all, am I doing it the right way? Second of all, im getting this error :Error #1010: A term is undefined and has no properties.

What is wrong?

EDIT: I want the array to look like this with x values in colum 1 and y values in colum 2:

snpr.cm/QpbNAz.png
2D array problem

[Action Script] Tile Based map editor May,2012

Hey guys so I've been working on a map editor, its been going really well.
I'm using good ol multi-d arrays.

I wont bore you with all my scripts as I'm having trouble with just one issue.
I'm trying to get a feature going where on start you click new map and give it the bitmapdata and tile size and so on.

ActionScript Code: ///New map hand coded            var canvasPlan:Array = [[100,100,100,100,100],            [100,100,100,100,100],            [100,100,100,100,100],            [100,100,100,100,100],            [100,100,100,100,100]];            trace(canvasPlan);                        //New map generated             var finalPlan:Array = new Array();            var plan2:Array = new Array();            //Create rows            for (var w:int=0; w<cWidth; w++) {                plan2.push(deFrame);            }            //Push into cols             for (var h:int=0; h<cHeight; h++) {                var insertPlan = plan2;                finalPlan.push(insertPlan);            }            ///Final array             canvasPlan = finalPlan;                                                trace(canvasPlan);
deframe=100, cwidth/height=4

They both seem to create the same array, then I create a new drawGrid object the does what it sounds like.

And this works, they both are drawn the same grid.

Later on down the line I have a pencil tool, select tile from palette then the array is changed via plan[var][var] and the bmp is updated to reflect that.

This works for the first hand coded array plan, but for the second generated one it will replace the entire column with the desired tile.

I've been trying really hard to figure this out, but I Just can't. So does anyone have an idea as to why it could be doing this, or a better method to write my array generation function.

=)
Tile Based map editor

[Action Script] Flash Player 9 May,2012

What are the new feature in Flash 9? How can I get it? Please anyone can help me about this? Please.....................................
Flash Player 9

[Action Script] Removing Object Question May,2012

If

var arrow:Arrow = new Arrow()

creates a new arrow in the memory and

addChild(arrow)

adds it to the display list,

parent.removeChild(this)

removes the object from the display list but how do you remove it from memory?
Removing Object Question

Monday, May 21, 2012

[Action Script] FlashDevelop smart snippets May,2012

Hello FlashDevelop users, would you be interested in this feature called smart snppets? This something I use very ofter and can't live without it, something that all other IDEs have (even Flash Builder!). You can see it in action here

youtube.com/watch?feature=player_detailpage&v=CuMdzxf4KVE

sappadev.com/blog/2012/05/smart-snippets-in-flashdevelop-ide

If you would, I could try to talk to FD guys to integrate it there, thought I did not have much luck last time, but this was a long time ago :)
Meanwhile you could check it out from FD branch and build it on your own.
FlashDevelop smart snippets

[Action Script] Actionscript & PHP May,2012

Hey guys,
I want to retrieve some values from my PHP file and put it in flash. So I've got the following PHP

PHP Code: $testID = 1;
$getTest_sql = mysql_query("SELECT testID, testText
                            FROM test
                            WHERE testID = '".mysql_real_escape_string($testID)."'");

if(mysql_num_rows($getTest_sql) > 0) {
    while($row_getTest = mysql_fetch_array($getTest_sql, MYSQL_ASSOC)) {
                echo stripslashes($row_getTest['testID']);
        echo stripslashes($row_getTest['testText']);
    }

Now I want to call it with flash, which actually works already. I use this code
Code: function mouse(e:MouseEvent) {
        var request:URLRequest = new URLRequest("[linkremoved].php");
        request.method = URLRequestMethod.GET;
       
        var loader:URLLoader = new URLLoader();
        loader.dataFormat = URLLoaderDataFormat.TEXT;
        loader.addEventListener(Event.COMPLETE, test);
        loader.load(request);
}

function test(e:Event) {
        testText.text = e.target.data;
}
So now there's one problem. I'm getting the testID and testText in one string. But I only want the testText. (now I know I can strike it from the PHP but that's not my point).

So I thought something like e.target.data.testText would work, but then flash gives me the following error: Property testText not found on String and there is no default value

So please help me, how do I get only the value of testText.
Actionscript & PHP

[Action Script] One click button script! May,2012

Hi

I am using flash for years, but I m not very good with action script.

I need help with scripts, problem below-

Page1 with alphabet buttons on it! Button A brings you to page 2

When I go back to Page1 (alphabet page) I want buttonA to be hidden, or deactivated etc.

The same with each letter in the alphabet. So even is the page reloads I need buttA hidden. Im using flash 8, actionscript 2.0.

I have tried many different scripts with no results.

Please help! Thank you.
One click button script!

Sunday, May 20, 2012

[Action Script] 3D snapping to mouse May,2012

Hello,

I'm relatively new to ActionScript 3 and I'm experimenting a bit now.

What I'm trying to do now is to let a rectangle snap to my mouse. The corners should come up a bit when I'm hovering over them. The more I go the the border of the rectangle the higher they should come up.

I'm trying a bit with rotationX and mouseX but doesn't really work as I would want it to work..


This is what I have now..
Anyone suggestions?

Code:                         if(x > 0 && y < 0) {
                                y = y * -1;
                        }
                        else if(x > 0 && y > 0) {
                        }
                        else if(x < 0 && y > 0) {
                                y = y * -1;
                                x = x * -1;
                        }
                       
                        container.rotationX = 10 * x;
                        container.rotationY = 10 * y;Demo what I have now: sht.tl/gmMw
3D snapping to mouse

[Action Script] Regex with strings that contain non-latin chars May,2012

I am having difficulty with a regex when testing for words that contain non-latin characters (specifcally Japanese, I haven't tested other scripts).

My code:
ActionScript Code: keyword = StringUtil.trim(keyword);//if(keywords.indexOf(keyword) == -1)regex = new RegExp("\\b"+keyword+"\\s*;","i");if(!regex.test(keywords)){Alert.show('"'+keywords+'" does not contain "'+keyword+'"'); keywords += keyword + "; ";}
Where keyword is
Code: 日本国and keywords is
Code: Chion-in; 知恩院; Lily Pond; Bridge; 納骨堂; Nōkotsu-dō; Asia; Japan; 日本国; Nihon-koku; Kansai region; 関西地方; Kansai-chihō; Kyoto Prefecture; 京都府; Kyōto-fu; Kyoto; Higashiyama-ku; 東山区; Places;When the function is run, it will alert that keywords does not contain keyword, even though it does:
Code: "Chion-in; 知恩院; Lily Pond; Bridge; 納骨堂; Nōkotsu-dō; Asia; Japan; 日本国; Nihon-koku; Kansai region; 関西地方; Kansai-chihō; Kyoto Prefecture; 京都府; Kyōto-fu; Kyoto; Higashiyama-ku; 東山区; Places; " does not contain "日本国"Previously I was using indexOf, which doesn't have this problem, but I can't use that since it doesn't match the whole word.

Is this a problem with my regex, is there a modifier I need to add to enable unicode support or something?

Thanks

Dave
Regex with strings that contain non-latin chars

[Action Script] Get specified Array items May,2012

Hello all,

I need a favor,

Q:How to get a group of an Array specified item, and then show it in a cell of DataGrid?

The problem looks like this:

I have an array:
ActionScript Code: var arr:Array=new Array('1','2','3','4','5');
and a DataGrid:
ActionScript Code: var dg:DataGrid=new DataGrid();dg.columns=["Col1","Col2"];
I want to add a group of specified arr Array to Col1 and Col2:

Col1 data will be = 1,4,5
Col2 data will be = 1,2,4

It's not like 'push', 'splice', 'slice','shift', etc. I just want to simply gathered a single array item with another to be a group in DataGrid as an Item. It should be like this:

dg.addItem({Col1:arr[0] and arr[3] and arr[4], Col2:arr[0] and arr[1] and arr[3]});

Can we do that? If we can, how to write the code correctly?

Thanks for your help!
:cool:
Get specified Array items

[Action Script] Writing to an external text file May,2012

I've been trying to figure out how to write data to an external txt file.
So far, I've managed to retrieve data from a pre-made file using the URLLoader method which is fine. Not what I want though. I found a tutorial that shows how to do write data using another language (php I think) but I'd rather not have to learn another language at the minute.

Does anyone know of a way I can read/write data using AS3? If not, what's my best bet?

Thanks in advance.
Writing to an external text file

[Action Script] will getTimer() run out May,2012

My game I'm developing uses getTimer() calls, as many do. What type of object is getTimer() returning, and most importantly, will it overflow or run out if someone plays for lets say 2 or 3 hours?
will getTimer() run out

[Action Script] After reload a swf I get TypeError: Error #1034: Type Coercion failed May,2012

I have a game in a swf. everything works fine the first time it loads... but if I unload and reload the swf. I get this:

Code: TypeError: Error #1034: Type Coercion failed: cannot convert com.client.games.shootGame.rowManager::Cell@3d3b5ca1 to com.client.games.shootGame.rowManager.Cell.I track the code to the breaking point:
Code: private function _createGrid():void {
       
                               
        for (var i:uint = 0; i < _cellsTall; i++) {       
                var _row:Vector.<Cell>;
                _row = new Vector.<Cell>;                               
                for (var j:uint = 0; j < _cellsWide; j++) {                                       
                        thisCell = new Cell(new Cell_display() as MovieClip, _cellWidth, _cellHeight);                                       
                        _row.push( thisCell );
                }
                pushRow(_row);
        }
        dispatchEvent(new RowManagerEvent(RowManagerEvent.UPDATED_DIMENSIONS));
}if I understand the error it says that the var " thisCell " is not an apropiated kind to insert inside the vector array " _row ". Is so weird...the var is the right kind... but this beat me today.

I hope someone has and idea or have this issue before.
After reload a swf I get TypeError: Error #1034: Type Coercion failed

Saturday, May 19, 2012

[Action Script] Scaling a movieclip help May,2012

Hey all,

I've been pretty confused about Scaling/resizing a movieclip. I'm probably googling the wrong terms, and for some reason search results in this forum don't display the entire thread, only the first post that includes one of my search keywords.

Anyways,
I'm interested in scaling/resizing a movieclip using AS. For instance, press key 87 (W) to make objectA stretch/scale onscreen.

Some guides have made use of the Z demension as though it were x or y:
ActionScript Code: objectA.z ++;Others have indicated that this was only introduced in CS4. Some say CS5. That sounds ridiculous to me, since it's all still AS3, unless CS4 and 5 included 3rd-party libraries.

Still others have indicated scale_x and scale_y commands. The guides I've found for these seem to be for website development, and I couldn't follow the code well enough to understand how scale_x and scale_y are used.

Some have said that only bitmap elements can be scaled.

Can anyone help or point me in the direction of a web resource? I don't need the best solution, I just want to know IF there is a solution for scaling a movieclip on command using AS3 (one that will work in any IDE, not just CS4/5/etc).
Scaling a movieclip help

[Action Script] Help with loadmovie May,2012

I have several frames (that the user cane movie between) that have movieclips loadMovie(ed) into them. Is there any way to NOT have to RE loadMovie when the user returns to a previous frame?

Thanks in advance!
Help with loadmovie

[Action Script] Calculating how much width for a DataGridColumn May,2012

I have a requirement here to make a column wide enough for only 8 characters. Unfortunately, mx:DataGridColumn doesn't deal in characters--only in pixels. But I'm not displaying pixels. How can I calculate how wide I need to make a column for the widest 8 alphanumerics based on the latest font?
Calculating how much width for a DataGridColumn

[Action Script] [AS2] How can I change my characters coordinates? May,2012

Ok, so for my class I have decided to make a game in flash, but i'm not used to flash code.
This is what I have so far, but i'm trying to make it so once the character makes it to the opposite side of the screen, or once his x coordinate is more than 500, his x coordinate gets reset to 0, so he like warps back. I need help, Thanks.

onClipEvent (enterFrame) {
if (Key.isDown(Key.UP))
{
_y -= 10;
}
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.DOWN))
{
_y -= -10;
}
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT))
{
_x -= 10;
}
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT))
{
_x -= -10;
}
}

onClipEvent (enterFrame)
{
if (player._x >= 550)
{
player._x == 0;
}
}
[AS2] How can I change my characters coordinates?

[Action Script] activate embeded flash without clicking in html page May,2012

Hello!
I've made a little game, in which the first action the player has to do is to press the space bar. I've embeded this small game in an html page. The problem is that the player need to first click in the area of the embeded flash before the space bar action will be affective. This game is not intended for web friendly poeple only, so I'm afraid that some of the users will not understand they have to activate the area of the embeded flash before playing.
Is there any way to activate it, with javascript for example, so the space bar pressing will be immediately effective? Or is it to be done in actionscript?
Thank you for helping me on this question! :o
activate embeded flash without clicking in html page

[Action Script] [AS3] Can anyone guide me in some ActionScript for flash game? May,2012

I need to do something if the ball hit the character then it go back up, but not the smooths bouncing it's something like the "Game and Watch" game.
I plays in movie clips, i wanted it to be when the ball hit the bear it goes back up but when it hit the target at top it bounce back down but something will drop from the target and the bear got to collect.
Do anyone can guide me?
I just need some keyword and a little bit of tutorial, because i'm stuck and lost. T^T
[AS3] Can anyone guide me in some ActionScript for flash game?

Friday, May 18, 2012

[Action Script] Stage3D to work with default movieclips May,2012

Hey guys,

Just wondering... Do you think Adobe will eventually integrate Stage3D in a way where we can benefit from hardware acceleration using normal Movieclips without having to use sprite sheets + Frameworks to avoid low level programming .... etc.

It would be GREAT to be able to grab a project and convert it to Stage3D-Friendly. I guess it's not that easy since all shapes are vectorial in flash but there could be some sort of "converter" or something....

I've played around with starling framework and it's great but converting a project to benefit from stage3D using starling right now would be a huge mess.
Stage3D to work with default movieclips

[Action Script] links from external XML work, but xml is not loading anymore after. May,2012

Hope somebody can help me...I have an external XML file loading in Flash. It worked perfect but since this week not anymore. The links in the XML file are the problem. I have no idea why.
In Flash I get the message:
Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.
The XML is loading the first time I click on the button and the link works, but after that no text and links are loading at all!

I give the code that I use:
var txtFld:TextField = new TextField();
var txtFmt:TextFormat = new TextFormat();

var xml:XML;
var urlLoader:URLLoader = new URLLoader();
var urlRequest:URLRequest = new URLRequest("background.xml");
urlLoader.load(urlRequest);
urlLoader.addEventListener(Event.COMPLETE, onComplete, false,0,true);
function onComplete(evt:Event):void {
evt.target.removeEventListener(Event.COMPLETE, onComplete);
xml = new XML(evt.target.data);
}

txtFmt.font = avenirRoman.fontName;
txtFmt.size = 12;
txtFmt.leading = 4;
txtFmt.color = 0x616161;
txtFld.defaultTextFormat = txtFmt;
txtFld.embedFonts = true;
txtFld.antiAliasType = AntiAliasType.ADVANCED;
txtFld.thickness = -100;
txtFld.sharpness = 50;
txtFld.multiline = true;
txtFld.wordWrap = true;
txtFld.width = 500;
txtFld.autoSize = TextFieldAutoSize.LEFT;
txtFld.x = 270;
txtFld.y = 145;



btn10.addEventListener("click", afterClick2);
function afterClick2(e:Event):void {
txtFld.htmlText = xml.INFO[0].toString();
addChild(txtFld);

}

btn11.addEventListener("click", afterClick3);
function afterClick3(e:Event):void {
txtFld.htmlText = xml.INFO[1].toString();
addChild(txtFld);

}

btn12.addEventListener("click", afterClick4);
function afterClick4(e:Event):void {
txtFld.htmlText = xml.INFO[2].toString();
addChild(txtFld);

}

Then I tried to put in extra (IOErrorEvent) code:


***urlLoader.addEventListener(IOErrorEvent.IO_ERRO R, catchIOError);
function catchIOError(event:IOErrorEvent){
trace("Error caught: "+event.type);
}
urlLoader.load(new URLRequest("Invalid XML URL"));
trace("Continuing with script...");***

Then I get the message:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at main3_fla::MainTimeline/afterClick2()

And the XML file is not loading at all.If I take out all the links in the XML, text is loading perfect.


example of the XML:

<?xml version="1.0" encoding="utf-8"?>
<GALLERY>


<INFO TITLE><![CDATA[<u><a href=url>website</a>]]></INFO>

</GALLERY>
Can anybody tell me what's wrong?
Thanks
links from external XML work, but xml is not loading anymore after.

[Action Script] Animation May,2012

hi all,

i need to make the animation using action script to my dynamic text(i.e output from server to flash)...can it be possible if so provide me a small example
Animation

[Action Script] Fully removing SWF from memory May,2012

Hi guys,

I'm completely new to Actionscript. I have worked out the following code to load a new swf...I am trying to make several SWF files load in sequence.

The mobile device I am putting these on, will not replay the same SWF twice, so I am assuming that the code is not properly removing the SWF files from the cache.

Please help if you can!!! Really need some advice.

Here's the code:

ActionScript Code: background_button.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_3);var fl_Loader_3:Loader;var fl_ToLoad_3:Boolean = true;function fl_ClickToLoadUnloadSWF_3(event:MouseEvent):void{    if(fl_ToLoad_3)    {        fl_Loader_3 = new Loader();        fl_Loader_3.load(new URLRequest("part02.swf"));        addChild(fl_Loader_3);    }    else    {        fl_Loader_3.unload();        removeChild(fl_Loader_3);        fl_Loader_3 = null;    }    fl_ToLoad_3 = !fl_ToLoad_3;}
Thanks
Fully removing SWF from memory

[Action Script] Drag horizontally and vertically at specific point May,2012

Hi, I am trying to create a drag and drop gear-lever effect and need some help please!
I would like the user to be able to drag the lever to 6 different gears, so initially user drags only horizontally and when the lever hitTests a point along the path s/he can drag both horizontally and vertically. It sounds really easy but I just cant get it working :(

Any help would be greatly appreciated!
Drag horizontally and vertically at specific point

[Action Script] error in action script 2 May,2012

hi guys,

when i am using this code.

submit.onPress = function(){
if(Title.text!="" && Comments.text !="" && Image.text!=""){
myData.Title = Title.text
myData.Comments = Comments.text
myData.Image = Image.text
myData.sendAndLoad("save.php", myData, "POST")
}
}
stop()
its is generating an error mgs...i.e

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 1: Statement must appear within on handler
button.onPress = function(){

Total ActionScript Errors: 1 Reported Errors: 1

why so please help me...
i am using Macromedia flash 8 which support as2...
error in action script 2

Thursday, May 17, 2012

[Action Script] Problem clearing phones memory for Flashlite May,2012

Hi everyone,

I've been trying to make a program that randomly plays interactive SWFs for my mobile phone (Flashlite).

You can click on one of the random SWFs and it plays then goes back to another SWF that loads a second one. This works fine for about 4 or 5 times, afterwhich it stops working.

I am guessing that the memory is getting clogged up. Could someone explain how to clear the phones memory after the SWF has finished?

Here is the script I'm using for the main file that randomly loads SWF files:

ActionScript Code: stop ();var movieArray:Array = ['template','words ~002','words ~003'];var loader:Loader = new Loader(); var index:int = movieArray.length * Math.random();var url:String = movieArray[index] + '.swf';movieArray.splice(index, 1); // this will remove that item from the arraytrace("Attempting to load", url);  loader.load(new URLRequest(url));  loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaderComplete);loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loaderIOError);addChild(loader);function loaderComplete(e:Event):void {              trace("Successfully loaded", url);}function loaderIOError(e:IOErrorEvent):void {               trace("Failed to load", url);}

Here is the script I'm using at the end of the random SWF files (to send it back to the main SWF):

ActionScript Code: var fl_ToLoad_3:Boolean = true;function fl_ClickToLoadUnloadSWF_3(event:MouseEvent):void{    if(fl_ToLoad_3)    {        fl_Loader_3 = new Loader();        fl_Loader_3.load(new URLRequest("greetings.swf"));        addChild(fl_Loader_3);    }    else    {        fl_Loader_3.unload();        removeChild(fl_Loader_3);        fl_Loader_3 = null;    }    // Toggle whether you want to load or unload the SWF    fl_ToLoad_3 = !fl_ToLoad_3;}


Any help would be really appreciated!!!
Problem clearing phones memory for Flashlite

[Action Script] Box and other shaped collision. May,2012

I wanna add collision to a box for a top-down angular game, the only problem is that I can't get it to work, i want it to work so that if the character hit the Y part of the box it should stop my characters movement, and if it hit the X part do the same. Any examples I could get?
Box and other shaped collision.

[Action Script] php and flash May,2012

Hi all,

I want to send data from flash to mysql using PHP ... and also i want to display the data on flash from mysql using PHP...

can it be possible if so please provide me a small example ...

thank ...
php and flash

[Action Script] error in Mouse Event May,2012

if i use MouseEvent then i am getting an error like this

" interface 'MouseEvent' could not be loaded.
function handlerBtnClick(e:MouseEvent):Void"

why so what is the problem ..
can u provide me a mouseevent simple code...for dynamic text field...
error in Mouse Event

[Action Script] action script May,2012

Hi all,

i am using Macromedia flash Professional 8.. In which i am not able to run my action script codes ... it is giving an error at event handlers what is the problem please help to an solution..
if there is any link to use cs3 or cs4 provide it ...

thank in advance..
action script

[Action Script] How to refresh the browser?? May,2012

I have a very basic question - how to reload/refresh the browser by using action script 2??

I have searched google but with no good result
How to refresh the browser??

Wednesday, May 16, 2012

[Action Script] action script May,2012

hi guys,

can we use actionscript3 in macromedia flash 8...
i am using in this where its giving an error when i run any action script program. what is the problem can we run the actionscript in macromedia flash 8..
action script

[Action Script] Drawing API Stroke width remains fixed even on scalling May,2012

Hi,
I am working on a printing app where I am using Drawing API to draw a rectangle. I have provided a functionality to control stroke width of the rectangle Code: graphics.lineStyle(10,0x000000);For printing purpose I will need to scale the rectangle to higher resolution so I am using scaleX and scaleY to 5 times. But scalling the movieclip is not working with the stroke of the rectangle. The stroke remains the same.

Please let me know how can i increase the stroke width when scaling the movieclip.

Thanks
Drawing API Stroke width remains fixed even on scalling

[Action Script] Error 1084 May,2012

I'm doing an assignment for class thats due tomorrow, and I need to have this finished soon.

I keep getting a 1084 error reading

Symbol 'home_mc', Layer 'Actions', Frame 1, Line 4 1084: Syntax error: expecting identifier before rightparen.

Symbol 'home_mc', Layer 'Actions', Frame 1, Line 5 1084: Syntax error: expecting rightparen before home_mc.

Here is my code, please help me. I'm a complete newb at this.

import flash.ui.Mouse;

home_mc.buttonMode = true;
home_mc.addEventListener(MouseEvent.ROLL_OVER,butt onOver,);
home_mc.addEventListener(MouseEvent.ROLL_OUT,butto nOut,);

function buttonOver(e:MouseEvent):void
{
e.currentTarget.gotoAndPlay("over");
}
function buttonOut (e:MouseEvent):void
{
e.currentTarget.gotoAndPlay("out");
}
Error 1084

[Action Script] Facebook Mobile API, uploading photo May,2012

ActionScript Code: import com.facebook.graph.FacebookMobile;import flash.geom.Rectangle;import flash.media.StageWebView;import flash.net.URLRequestMethod;FacebookMobile.init("my app id", afterInit);function afterInit(a:*,b:*):void{    var stageweb:StageWebView = new StageWebView();    stageweb.stage = this.stage;    stageweb.viewPort = new Rectangle(230,120,400,500);    FacebookMobile.login(this.afterLogin, this.stage, ["publish_stream", "user_photos"], stageweb);}share.addEventListener(MouseEvent.MOUSE_DOWN, sharebuttonHandler);function sharebuttonHandler(event:MouseEvent):void{    var bd:BitmapData = new BitmapData(stage.stageWidth,stage.stageHeight);        bd.draw(stage);        var screenshot:Bitmap = new Bitmap(bd);        screen.source = screenshot;                var params:Object = { image:screenshot, message:'Test Photo', fileName:'FILE_NAME' };        FacebookMobile.postData("/me/photos", null, params);}function afterLogin(success:*, b:*):void{    if (success)    {        username.text = success.user.name;        userImg.source=FacebookMobile.getImageUrl(success.uid,"small");            }}

i need help with posting a photo to facebook.

i know this part is totally wrong, im not sure how to get it to work:

var params:Object = { image:screenshot, message:'Test Photo', fileName:'FILE_NAME' };
FacebookMobile.postData("/me/photos", null, params);

id appreciate the help, thanks.


well it actually works, although i get this error output:

TypeError: Error #1006: value is not a function.
at com.facebook.graph.core::AbstractFacebook/handleRequestLoad()[C:\Users\facebookGraphApi\api\com\facebook\graph\c ore\AbstractFacebook.as:245]
at com.facebook.graph.net::AbstractFacebookRequest/dispatchComplete()[C:\Users\facebookGraphApi\api\com\facebook\graph\n et\AbstractFacebookRequest.as:290]
at com.facebook.graph.net::AbstractFacebookRequest/handleDataLoad()[C:\Users\facebookGraphApi\api\com\facebook\graph\n et\AbstractFacebookRequest.as:272]
at com.facebook.graph.net::AbstractFacebookRequest/handleURLLoaderComplete()[C:\Users\facebookGraphApi\api\com\facebook\graph\n et\AbstractFacebookRequest.as:248]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
Facebook Mobile API, uploading photo

[Action Script] Any reason why this time generator isn't working properly? May,2012

As a minor element of a project, I have the following code to call the current date and time to be displayed in the format: 'Tue 12:26 PM' within a dynamic text box.

ActionScript Code: var dtDay:Array = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];var dtHours:Array = ["12","1","2","3","4","5","6","7","8","9","10","11","12","1","2","3","4","5","6","7","8","9","10","11"];var dtMins:String;var ampm:String;var dateTimer:Timer = new Timer(1000);dateTimer.addEventListener(TimerEvent.TIMER, updateTime);dateTimer.start();function updateTime(event:TimerEvent):void{    var datetime:Date = new Date();    if (datetime.hours >= 12) {        ampm = " PM";    } else {        ampm = " AM";    }    if (datetime.minutes <= 9) {        time_txt.text = String((dtDay[datetime.day]) + " " + (dtHours[datetime.hours]) + ":0" + datetime.minutes + ampm);    } else {        time_txt.text = String((dtDay[datetime.day]) + " " + (dtHours[datetime.hours]) + ":" + datetime.minutes + ampm);    }}
The code displays the following when run 'Tue PM', and I am unsure as to the source of the problem. It appeared to be working fine yesterday at different points in the day (3:10, 4:45, 5:00pm, etc.)

Help would be greatly appreciated. Still rather new to this.
Any reason why this time generator isn't working properly?

[Action Script] [AS2] help making flash game May,2012

I have a flash game with three frames,
one is red, the second blue and the third
one is yellow and all I would like to do is
not to make to left button work until, I get
to the blue frame. not before or after (only one the blue frame I would like to go from this blue frame to a orange frame. :eek:


I've tryed to use "void" so that I can't go left until I reach
the blue frame but its not going to well
[AS2] help making flash game

Tuesday, May 15, 2012

[Action Script] [AS3] Radio Button - help with if/else statement May,2012

I have a form that as someone fills it out, animations on the stage become visible. For instance, I have one that says "are you Male or Female" with radio buttons and I want a male of female animation on the stage to become visible when the respective button is selected.

I tried writing my Actionscript 3 code like
ActionScript Code: MalePerson.visible = false;FemalePerson.visible = false;if(radioMale.selected = true) {        MalePerson.visible = true;    }    else if (radioMale.selected = false){FemalePerson.visible = true;}
MalePerson is the animation on the stage that will become visible and "radioMake" is that radio buttons instance name. Im just not sure how to write the "if" statement so that the animation will appear when the button is selected and not waiting on a "submit" button to be pressed.

Any help would be appreciated.

Thank you.
[AS3] Radio Button - help with if/else statement