Quantcast
Channel: Adobe Community : Popular Discussions - ActionScript 3
Viewing all 18626 articles
Browse latest View live

ActionScript 3.0 Mouse Over and Mouse Out scripting error

$
0
0

Trying to figure out a way to reverse a movie clip when I Mouse out.

 

here's my code right now:

 

Image_zoom.stop();

 

Image_zoom.addEventListener(MouseEvent.MOUSE_OVER, fl_MouseOverHandler_3);

 

function fl_MouseOverHandler_3(event:MouseEvent):void

{

    Image_zoom.play();

}

 

It plays the video when I hover over with my mouse but when I move my cursor off it pauses the movie clip. Can it reverse on a mouse out regardless of play point.

 

Anything will help!

Thanks!


ActionScript 3 - using a button to navigate Scene's

$
0
0
Hi there!

To say that I am a new-comer to ActionScript 3 is an understatement. Thats where you come in (hopefully).

I've designed a website to show off some of my work, but have built it within different Scenes.

I've searched high and low, read books, signed up to tutorials, and even looked on the Forum's... but cannot find a simple script that will allow me to send people back and forth from scene to scene (or a nice easy explanation - that won't cause my head to self-implode).

I know its asking a lot, and you could argue there is sufficient information already on the Forums to piece it together... but I would call you a liar! It seems as though the tutorials are all very "oh - you all know Actionscript 2... so we won't go through the basics"

Cheers anyway, hopefully hear back from any of you AS guru's.

Ewan

URLVariables.decode() error when converting to variables

$
0
0

Hello!

 

I am passing a simple string from a PHP file, that looks like this

 

PHP Code:

 

$connect = mysql_connect("localhost", "root", "");
mysql_select_db("dev", $connect);
$result = mysql_query("SELECT * FROM users");
$cant = 0;
while($row=mysql_fetch_array($result)){
    echo "Name$cant=$row[name]&Email$cant=$row[email]&";
    $cant++;
}

 

PHP output:

Name0=jane doe&Email0=jane@huj.com&Name1=jane doe&Email1=jane@huj.com&Name2=jane doe&Email2=jane@huj.com&Name3=jane doe&Email3=jane@huj.com&Name4=jane doe&Email4=jane@huj.com&

 

I am asking flash to prase this data and display each field in a text field, it seems as it is failing at the  myTextLoader.dataFormat = URLLoaderDataFormat.VARIABLES; because when i take it out or switch the dataFormat to TEXT, it does not produce that error

 

Flash Code:

 

var myTextLoader:URLLoader = new URLLoader();
var request:URLRequest = new URLRequest("http://localhost/flash.php");
myTextLoader.load(request);
myTextLoader.addEventListener(Event.COMPLETE, onLoaded);
myTextLoader.dataFormat = URLLoaderDataFormat.VARIABLES;

 

function onLoaded(e:Event):void {
for (var i:Number = 0; i < 9; i++) {
//array for text fields
var nameField:TextField = new TextField();
var emailField:TextField = new TextField();
nameField.text = myTextLoader.data["Name" + i];
emailField.text = myTextLoader.data["Email" + i];
emailField.y += 50;
emailField.x = 200;
nameField.y += 50;
nameField.x = 150;
addChild(nameField);
addChild(emailField);
}
}

 


Flash Error:

 

Error: Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs.
    at Error$/throwError()
    at flash.net::URLVariables/decode()
    at flash.net::URLVariables()
    at flash.net::URLLoader/onComplete()

 

 

 

Any Suggestion as to what needs to be changed in order for it to work, i tried to trace stuff, change the variable scope etc.

 

Read up on this online at Flash Docs, but it seems as though the syntax is correct

 

 

Thank you

How to open a folder using Actionscript 3.0

$
0
0

Hi,

I have been trying for about a day to get this to work, but nothing seems to, so i'm finally going to ask.

 

So far, code wise, i have this:

 

     open_btn.addEventListener(MouseEvent.CLICK, OpenButtonHandler);

     function OpenButtonHandler(event:MouseEvent):void

    {  }

 

From there, what code gets flash to literally open up a folder such as My Documents? The end use of this code will be for a CD, whereby the flash .exe file will call up folders from the disc through clicking buttons. Also, please make me awear of under what situations the code may not work. At the moment, i am writting the .exe file to the desktop, and trying to open a folder on my desktop through the application.

Often times, everything i have tried so far, either causes Syntax Errors or no errors, but just doesn't work.

Thanks,

Ricky

 

EDIT:

Primarily in Windows, but if you know the Mac way too, that could be useful.

Stop Play action script 3 for mp3 on layer

$
0
0

I this the wrong way to write a stop play for mp3 on layer.

I have buttons and sound within a movieClip.

Should I give outside movie clip instance name

Thanks

 

 

 

 

 

play_btn.addEventListener(MouseEvent.CLICK, playSound);
stop_btn.addEventListener(MouseEvent.CLICK, stopSound);

 

function playSound(e:MouseEvent):void {
    this.play();
}

 

function stopSound(e:MouseEvent):void {
    stop();
}

check to see if a loaded sound file is still playing

$
0
0

Is there a way in AS3 to determine if a loaded sound file is still playing or not?  I need to start an animation when a sound starts and stop the animation when the sound is done playing.

 

Thanks

How do I remove a child from the stage using a button click?

$
0
0

I have a movieclip that requires Play, Pause, Forward and Back buttons. The movieclip has actionscript at various frames to load movieclips from the library and repeat them.

I have tried using a timeline scrubber but it does not trigger the actionscript when scrubbing, only when the movie plays normally.

My possible solution is to create Fwd and Back buttons that can go to specific frames where key animations will begin.

I need to develop actionscript that will remove Children when the user clicks Back.

 

This is how I am loading several movieclips along the timeline from my library:

var shpA1:arSHPp1;

function attachAR1 () {

  shpA1 = new arSHPp1 ();

  shpA1.x = -30;

  shpA1.y = 18;

  addChild (shpA1);

  }

//the interval is used to repeat the animation to represent continuous flow on a diagram

var myInterval1:uint = setInterval (attachAR1, 500);



This what I have tried so far (not working at all - no errors or trace):

function remChild1(event:MouseEvent) :void {

    if(shpA1.stage)

    {

        trace("arSHPp1 is in display list");

        shpA1.parent.removeChild(shpA1);

        shpA1 = null

    }

    else

    {

        trace("arSHPp1 isn't in display list");

    }

Publish apps in Play store.

$
0
0

If i publish a game, make with adobe cs5.5 in play store, the users who download this game on their phones are obliged to download adobe air to run the game?


Load and unload the external swf file using AS3(for window, IOS and android)

$
0
0

For the external swf file loading, I use this code

 

 

-----------------------------------------------------------------------------------

 

load2.addEventListener(MouseEvent.MOUSE_DOWN, newvid);

function newvid(event:MouseEvent) {

          trace("you clicked me");

          var loadit = new Loader();

          addChild(loadit);

    var _lc:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);

    loadit.load(new URLRequest("scene02.swf"), _lc);

}

 

------------------------------------------------------------------------------------

 

 

its working great but I don’t know how to unload the loaded swf files (looking: unload one by one and unload all)

 

 

 

_______________________________________________________________

in AS2 we have

on (release) {

          loadMovieNum("scene2.swf", 1);

          unloadMovieNum(2);

          unloadMovieNum(3);

}

but i need in AS3

SWF encryption ** Very urgent please help **

$
0
0

Hi All,

 

I need a help from you. It's very urgent. Actually we used Amayeta encrypt SWF software to protect our files. Recently, our licence expired and we tried to renewal it but, it seems that the Amayeta site is suspended. We came to know that Amayeta released the standalone product for SWF encrypt 7.0 before they closed their business. Anyone knows how can we get that product back? Can you please help us to get that standalone version?

 

Thanks in advance.

 

Thanks & Regards,

Rajaguru.V

How to protect my swf files from decompile?

$
0
0

Dear Friends,

 

Greetings! I want to protect my swf files from decompile and image and animation stealing. Please suggest me the ways to do it. Already I was trying with some as follows:

 

1) swf encrypt 7 I purchased It was working fine. but suddenly they closed it is not working now.

2) I tried with leawo swf encrypt - its encrypting but not working for my files. it is crashing my files where I used 3d tweening.

3) I tried trial version of swf protection its not working for my frame, like iam loading all my swf in a frame, swf file is working but frame is not working..

 

please suggest me a right ways to protect my swf files....

 

Thanks in advance,

 

Regards,

Syed Abdul Rahim

password protecting a swf: effective or not?

$
0
0

hi.

I've created a password variable w/input text on the first frame of a swf to enable private viewing of a swf; so if you dont know the password you cant procedd to frame 2, to see the whole thing.

 

Is this effective?

Saving Data from Air for Android App to A server

$
0
0

Hi,

 

I developed a flash-card-like app. Users can review key terms and can take quizzes to assess how they do on these quizzes. The scores they get on these quizzes are currently saved to a sharedObject. One way users can send me back this info is by a mailto function where the info is sent to me via email.

 

How can I have these scores sent from the app to a server that I can specify? I have no knowledge of serve side scripting. Ideally, I would like to create a button in the app that syncs the data to the server! It seems to be a simple straightforward thing, but I am lost. Any help would be appreciated.

 

Everything I coded works fine. Data is saved to the sharedObject, I can trace that it is saved. I just want the functionality to be able to send the data via a server with a click of a button. Should I have used a remoteSharedObject? I dont know how to integrate them in a way to have this data emailed to the server. Any help would be appreciated.

 

I expect to release the app to both Android and iOS.

 

Thank you for any suggestions or advice

Issues with pausing the timeline and timing

$
0
0

I am making a pretty simple home page news/image scroller that you see on many sites now. A rectangle box that goes through the various important stories and it also has controls to go forward and backward if needed. I have it laid out and I found a line of code to make it pause on each story for however long I want. I then added the first button to go back to the first frame (the first news story) at any time. When I test the movie the pausing is right and the button works. The problem is, the more I press the button the more the timing of the movie changes. It no longer paused for 10 seconds per story and it just starts pausing for random amounts of time. I know it has to be a code issue and I assume the code is stacking commands on top of each other for some reason and screwing up the timing. The code I am currently using for each story is:

 

stop();

setTimeout(play, 10000)

 

Like I said if I play the movie the timing thing works great. It stays on each story for 10 seconds then animates to the next just like I want. The button is what seems to mess it up but I need buttons for the user to control the whole thing. The code I am using for the button is:

 

button_1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_2);

 

function fl_ClickToGoToAndPlayFromFrame_2(event:MouseEvent):void

{

    gotoAndPlay(1);

}

 

Is my button code screwing this up? Any help would be appreciated thanks.

Individual enterframe events in actionscript 3

$
0
0

Hello i am currently working on my first artillery game. I am following this great tutorial http://www.emanueleferonato.com/2007/04/28/create-a-flash-artillery-game-step-1/. However i want to make my game in AS3 so i am trying to implement the code to AS3 which has been no problem so far. But i am stuck on this step:

 

  cannonball_fired.onEnterFrame=function(){

        this._x+=this.dirx/50;

        this._y+=this.diry/50;

  };

 

How would i do something like this in AS3 without declaring a new canonball class? I just want to keep all the code on my actions frame. Thanks in advance


Syncing BPM (Beats Per minute) to Frames

$
0
0

If i had an audio clip that was at exactly 85 BPM (beats per minute), could I move a graphic image along with it at the same time using actionscript? Could the site listed below that converts BPM to FPS or BPM to Time help with the actionscript needed to do so?

 

http://pacleb.com/bpm-converter/convert/go

 

Thanks,

Henry

How to Make Multiplayer TCP Flash Game?

$
0
0

I have a game in the works, and though I got the UDP to work perfectly, I sadly later found out that that is simply just a lossy protocol. There's apparently (as far as my knowledge goes) nothing you can do to make it resend data if the data was not received successfully by the recipient.

 

So, I was wondering how to use TCP? I've heard it's possible, but I can't seem to find a single tutorial or any information anywhere on how to do it. I found on Adobe's site socket connections, and though I got the server to connect (I think), I have no clue how to send data to it, how to get other clients to connect to it, etc. Any help?

 

This is the script I've been using, and though it does connect... that's basically all it does, I don't know where to go from here...

 

package

{

    import flash.display.Sprite;

    import flash.events.EventDispatcher;

    import flash.events.Event;

    import flash.events.*;

    import flash.events.IOErrorEvent;

    import flash.events.ProgressEvent;

    import flash.events.ServerSocketConnectEvent;

    import flash.net.ServerSocket;

    import flash.net.Socket;

    

    public class TCP extends Sprite

    {

        private var serverSocket:ServerSocket;

        private var clientSockets:Array = new Array();

 

        public function TCP()

        {

            try

            {

                // Create the server socket

                serverSocket = new ServerSocket();

                

                // Add the event listener

                serverSocket.addEventListener( Event.CONNECT, connectHandler );

                serverSocket.addEventListener( Event.CLOSE, onClose );

                

                // Bind to local port 8087

                serverSocket.bind( 8087, "127.0.0.1" );

                

                // Listen for connections

                serverSocket.listen();

                trace( "Listening on " + serverSocket.localPort );

 

            }

            catch(e:SecurityError)

            {

                trace(e);

            }

        }

        public function connectHandler(event:ServerSocketConnectEvent):void

        {

            //Thesocket is provided by the event object

            var socket:Socket = event.socket as Socket;

            clientSockets.push( socket );

            

            socket.addEventListener( ProgressEvent.SOCKET_DATA, socketDataHandler);

            socket.addEventListener( Event.CLOSE, onClientClose );

            socket.addEventListener( IOErrorEvent.IO_ERROR, onIOError );

            

            //Send a connect message

            socket.writeUTFBytes("Connected");

            socket.flush();

            

            trace( "Sending connect message" );

        }  

        public function socketDataHandler(event:ProgressEvent):void

        {

            var socket:Socket = event.target as Socket

            //Read the message from the socket

            var message:String = socket.readUTFBytes( socket.bytesAvailable );

            trace( "Received: " + message);

 

            // Echo the received message back to the sender

            message = "Echo -- " + message;

            socket.writeUTFBytes( message );

            socket.flush();

            trace( "Sending: " + message );

        }     

        private function onClientClose( event:Event ):void

        {

            trace( "Connection to client closed." );

            //Should also remove from clientSockets array...

        }

        private function onIOError( errorEvent:IOErrorEvent ):void

        {

            trace( "IOError: " + errorEvent.text );

        }

        private function onClose( event:Event ):void

        {

            trace( "Server socket closed by OS." );

        }

}}

Flash keeps crashing upon exporting & trying to publish SWF

$
0
0

 

This is a problem that hasn't stopped for a few days and I urgently am in need of help. After animating one of my scenes, flash is now crashing whenever I try to publish the SWF. For several days, I've looked for ways to fix this problem, but unfortunately, it's been to no avail so far.The closest explanation I've found is the number of keyframes might be too much. I don't want to get rid of other important parts of my flash project, I would like to keep everything and stop the crashing. Help!

 

Check if button was clicked

$
0
0

Hello!

 

I have a short question to ask. Is there any way of testing if a button was clicked using as3?

 

I have 3 different buttons and I want to test if the right button was clicked, then the user would see the message "Correct". Otherwise, if any of the other 2 buttons were clicked, the message would be "Incorrect".

 

Thank you for your help!

Content on this page requires a newer version of Adobe Flash Player...What??

$
0
0

Hi,

 

I have a really enoying problem here, please help me out!

 

I have built my personal webpage in Flash CS3/AS3. I did some updates today, changed some pictures and stuff. Now when I upload and replace the previous *.swf on the server, and try to load my webpage my browser displays the folowing message:


Content on this page requires a newer version of Adobe Flash Player.

 

I tried exporting with Flas Player 8, and checked it using different bowsers too (curenntly I use the latest version of Firefox), but I get the same error when trying to relode my site. I have no more ideas what to do.

 

 

Please help....

Regards

Viewing all 18626 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>