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

create flash form and submit to email For CD (not website)

$
0
0

hi , i see many tutorial about create flash form and submit them to an email

 

all of them link to an php file must copied to web host .

 

 

i have website and host , but i dont want to upload swf (flash) file ( form ) to my website and run it from intetnet browsers

 

 

i want to use this form in my advertising CD so customer can fill form and send it to my mail if have internet connection.

 

so can i link and connect between my swf on CD and php file on CD or host ??  is this possible ??  

 

 

thanks


send mail in as3

$
0
0

acually am tring to send mail but am new in as3 as well , i could make it using as2 but unfortunately i build my project by as3 , they telling me tht i need PHP file to connect with , is there any tutarial or help on it ?

i approciate ur help

thnx

Turn off sound of swf when popup page closed.

$
0
0

I have a pop up page with a swf file that will call a second swf file:

 

var myLoader:Loader = new Loader();
addChild(myLoader);
var url:URLRequest= new URLRequest("File2.swf");
myLoader.load(url);

 

But the sound keeps playing even after the popup page closed.

I'm trying to turn it off once the popup html page closed.

I did some research, got this code, but don't know how to implement it into the codes above:

 

SoundMixer.stopAll();

 

I'm new on AS3, please help.

Thanks.

Using Variables- I Pray To You Gods of AS3/PHP and Flash For Help!

$
0
0

Please oh PLEASE!!! You kind souls, help this wretched person.

Cannot get my variables to work.  My relevant sections of code:

AS3:
var request:URLRequest = new URLRequest ("http://www.XXXXX.com/pages/XXXX/XXXXindex.php");
request.method = URLRequestMethod.POST;
var flashvars:URLVariables = new URLVariables();
flashvars.idtag = this.loaderInfo.parameters.id;           
flashvars.hoster = "";
flashvars.guest = "";
request.data = flashvars;
var loader:URLLoader = new URLLoader (request);
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.load(request);
loader.addEventListener(Event.COMPLETE, onComplete);
function onComplete (event:Event):void
{
    var flashvars:URLVariables = new URLVariables( event.target.data );
    hoster.String = flashvars.hoster;
    guest.String = flashvars.guest;
}
          
  
var hoster;
var guest;

 

PHP index.php:


<?php
$hoster = $_COOKIE['hoster'];
$guest = $_POST[guest];
?>

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>
        <title>record</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <script type="text/javascript" src="swfobject.js"></script>
        <script type="text/javascript">
            var swfVersionStr = "10.1.52";
            var xiSwfUrlStr = "";
            var flashvars = "hoster:<?php echo (urlencode($hoster)) ?>&guest:<?php echo (urlencode($guest))?>";
            var params = {};
            params.quality = "high";
            params.bgcolor = "#d0e2ff";
            params.play = "true";
            params.loop = "true";
            params.wmode = "window";
            params.scale = "showall";
            params.menu = "true";
            params.devicefont = "false";
            params.salign = "";
            params.allowscriptaccess = "sameDomain";
            var attributes = {};
            attributes.id = "record";
            attributes.name = "record";
            attributes.align = "middle";
            swfobject.createCSS("html", "height:100%; background-color: #d0e2ff;");
            swfobject.createCSS("body", "margin:0; padding:0; overflow:hidden; height:100%;");
            swfobject.embedSWF("record.swf?hoster:<?php echo (urlencode($hoster)) ?>&guest:<?php echo (urlencode($guest))?>", "flashContent","750", "650", swfVersionStr, xiSwfUrlStr, flashvars, params, attributes);

 

Page loads, but no action.  Please tell me what I am missing or doing wrong.

HTTP Post of ByteArray

$
0
0

Hello, I hope this is the right place for this question.

 

In the first set of code below, I create a request using a ByteArray as my binary data. The server doesn't recognise it as a valid file and does not work. If I perform all the same tasks but write the ByteArray to a temporary file and then read it out again, everything works fine. What am I missing?

 

I am trying to POST binary data via HTTP. My original code, which almost works looks like so:

 

            dataString += twoHyphens + boundary + lineEnd;
            dataString += "Content-Disposition: form-data; name=\"Filedata\"; filename=\"" + entity.fileName +"\"" + lineEnd;
            dataString += "Content-Transfer-Encoding: binary" + lineEnd;
            dataString += "Content-Type: application/octet-stream; name=" + entity.fileName + lineEnd;
            dataString += lineEnd;
           
            outputBytes.writeMultiByte(dataString, "ascii");

            outputBytes.writeBytes(dataArray);

            outputBytes.writeMultiByte(lineEnd, "ascii");

 

This does work:

 

            dataString += twoHyphens + boundary + lineEnd;
            dataString += "Content-Disposition: form-data; name=\"Filedata\"; filename=\"" + entity.fileName +"\"" + lineEnd;
            dataString += "Content-Transfer-Encoding: binary" + lineEnd;
            dataString += "Content-Type: application/octet-stream; name=" + entity.fileName + lineEnd;
            dataString += lineEnd;

            outputBytes.writeMultiByte(dataString, "ascii");

           
            var fileStream:FileStream = new FileStream();
            var tempDirectory:File = File.createTempDirectory();
            var tempFile:File = tempDirectory.resolvePath(entity.fileName);


            try {
                fileStream.open(tempFile, FileMode.WRITE);
                fileStream.writeBytes(dataArray);
                fileStream.close();
                fileStream.open(tempFile, FileMode.READ);
                fileStream.readBytes(dataArray);
                fileStream.close();
            }
            catch(error:Error)
            {
                trace(error.getMessage());
                return;
            }           
            outputBytes.writeBytes(dataArray);           
            outputBytes.writeMultiByte(lineEnd, "ascii");

How to add URL links in XML file?

$
0
0

Hi,

 

I'm having problem with adding the URL links to the flash output. I'm using the XML file to call images and then the corrsponding links. Images are called correctly but when I try to add a link I'm not getting the links, but instead getting the HTML anchor tags as texts. I'm using the XML escape characters to escape the HTML tags but the results are not what I need.

 

I'm using the following code:

 

<thumbnail preview="large.jpg" thumb="thumb.jpg">
            <title><![CDATA[Finance Services]]></title>
            <discription><![CDATA[&lt;a href=&quot;http://www.google.ca">Google</a>]]></discription>
</thumbnail>

 

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

Output:

Images are displayed correctly, but instead of getting the links, I'm getting following text message:

<a href="http://www.google.ca">Google</a>

 

 

I need to find out what I'm doing wrong. Am I using the correct way to add the links or not?

 

Thanks for your time.

Stop push from overwriting values in an array

$
0
0

Hi,

I'm trying to create an array containing scores and usernames which I can then sort and display in a table, but I'm stuck on one issue. When I try to push a second score to the highscores array, it saves again at position 0 rather than adding new data to position 1 and so on. In the following code, myScore contains the score that the user just achieves and myName contains their set username.

 

var highscores:Array=newArray();
highscores
.push({score: myScore, player: myName});
highscores
.sortOn("score",Array.DESCENDING |Array.NUMERIC);

for(var i:int=0; i < highscores.length; i++)
{
  trace
(highscores[i].score, highscores[i].player);
}

 

How can I get this to add to the array rather than overwriting current data?

Thanks.

Duplicate function definition error

$
0
0

Hello all!

 

One of the the most annoying errors to get is the "duplicate function definition" error! I appreciate that Flash doesn't want to see the same function twice...

 

... But what about the same function used in two different sections (labels) of one site? I've got two different slideshows in two different sections of my site, and I need the same function called out for each.

 

The function is function nextImage():void

 

If I remove it one, that slideshow doesn't work (remains fixed on image 1 of the slideshow).. if I keep it in, nothing works!

 

Any ideas for a work-around? I had wanted to use the same script for both slideshows, but forget that! So, I found another script for a different type of slideshow. I thought I'd be safe taking that approach. Apparently not.

 

Thanks!!!


What is TypeError: Error #1009: Cannot access a property or method of a null object reference.

$
0
0

It always warn me this message.

 

TypeError: Error #1009: Cannot access a property or method of a null object reference.

at MethodInfo-9()

TypeError: Error #1009: Cannot access a property or method of a null object reference.

at MethodInfo-12()

 

mycode is here:

 

var count:Number = 0;
var objectoriginalX3:Number;
var objectoriginalY3:Number;

this.stop();

date.buttonMode = true;
date.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject3);
date.addEventListener(MouseEvent.MOUSE_UP, dropObject3);

authorQ3.buttonMode = true;
authorQ3.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject3);
authorQ3.addEventListener(MouseEvent.MOUSE_UP, dropObject3);

titleQ3.buttonMode = true;
titleQ3.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject3);
titleQ3.addEventListener(MouseEvent.MOUSE_UP, dropObject3);

publication.buttonMode = true;
publication.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject3);
publication.addEventListener(MouseEvent.MOUSE_UP, dropObject3);


function pickupObject3(event:MouseEvent):void {
event.target.startDrag(true);
event.target.parent.addChild(event.target);
objectoriginalX3 = event.target.x;
objectoriginalY3 = event.target.y;
}

function dropObject3(event:MouseEvent):void {
event.target.stopDrag();
var matchingTargetName:String = "target" + event.target.name;
var matchingTarget:DisplayObject = getChildByName(matchingTargetName);
  if (event.target.dropTarget != null && event.target.dropTarget.parent == matchingTarget){
  event.target.removeEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
  event.target.removeEventListener(MouseEvent.MOUSE_UP, dropObject);
  event.target.buttonMode = false;
  event.target.x = matchingTarget.x;
  event.target.y = matchingTarget.y;
 
  response_mc.gotoAndStop(1);
  nextquestion.gotoAndStop(1);
 
  count++;
  if (count==4){
   response_mc.gotoAndStop(2);
   nextquestion.gotoAndStop(2);
   nextquestion.addEventListener(MouseEvent.CLICK, question3);
   function question3(event:MouseEvent):void{
    gotoAndStop(4);
    date.gotoAndStop(2);
    authorQ3.gotoAndStop(2);
    titleQ3.gotoAndStop(2);
    publication.gotoAndStop(2);
   
    response_mc.gotoAndStop(1);
    nextquestion.gotoAndStop(1);
   }
  }
 
 
} else {
  event.target.x = objectoriginalX3;
  event.target.y = objectoriginalY3;
  }

}

How to stop movieclip from playing?

$
0
0

How do I stop a movieclip from playing? I want the animations in the movieclip to not play from the beginning of my main timeline. this.stop() stop the whole animation. this.mc.stop() is not working. mc.stop() is not working.

AS3 Next and previous buttons - jump to keyframe

$
0
0

You know, I used to know AS2.  It was fun.  It was easy.  And then after a break I've tried to pick up AS3 and everything is going horribly, horribly wrong.  Even searching online forums I can't work out how to get the solution I need.  I could revert back to AS2, but I am determined I am not going to let AS3 beat me.  Someone please help!

 

I am trying to add Next and Back buttons that will jump users between keyframes.

 

I have a layer called Actions, and a layer called Buttons.  The Buttons layer has two buttons of different types with Instance Names of "btn_Next" and "btn_Back" respectively.

Both layers have keyframes at frame 30 and frame 60.

 

The actions on frame 30 and frame 60 both say "stop();"

 

At present the action on frame 1 on the Actions layer says:

 

import flash.events.MouseEvent;

 

stop();

 

btn_Back.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler1);

function mouseDownHandler1(event:MouseEvent):void

{

prevFrame();

}

 

btn_Next.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler2);

function mouseDownHandler2(event:MouseEvent):void

{

nextFrame();

}

 

When I press Ctrl + Enter I am currently getting the error message

 

"TypeError: Error #1123: Filter operator not supported on type builtin.as$0.MethodClosure. at [Filename]_fla::MainTimeline/frame1()"

 

and the buttons do nothing.

 

Where am I going wrong? 

 

The thing I get particularly confused about reading other posts is whether I need to reproduce this code on each keyframe, or only on Frame 1 of the Actions layer.  I tried adding it to each keyframe, but then got errors about duplicating my functions.  So I tried removing the functions from all keyframes after the first one, but that didn't work either. 

 

I tried changing my instance names on each keyframe and changing the code on each keyframe, but that didn't seem to work either.  And it seems like a really inefficient way to do things.

 

Someone please help me. 

 

Mary

getDefinitionByName.. Variable is not defined.

$
0
0

showing error:

ReferenceError: Error #1065: Variable slip2 is not defined.

    at global/flash.utils::getDefinitionByName()

    at code::slip()

 

package code{

    import flash.display.MovieClip

    import flash.utils.getDefinitionByName;

    import code.slip1

    import code.slip2

    import code.slip3

    import code.slip4

   

    public class slip extends MovieClip{

        private var mymc:MovieClip;

        public var menupos:Array=new Array()

       

        public function slip(no:int){

            var slipname:String='slip'+no

            mymc=new (getDefinitionByName(slipname))()

            addChild(mymc)

        }

    }

}

Calling a variable from inside a movieclip AS3 in Flash CS4

$
0
0

I am trying to trace a variable string from inside a movieclip which is inside another movieclip on the main timeline using:

 

trace(VariableString);

and also

trace(stage.VariableString);

 

Neither work

The variable is an input textfield and traces fine when it is on the main timeline but will not work from inside the movieclip. I am using Actionscript 3 in Flash CS4.

I appreciate this has probably been discussed previously on this forum but I cannot find a difinitve answer that seems to work.

 

Thanks

call flash function from javascript

$
0
0

Hi all I have made instructions function in flash I need to call that from javascript.

 

Thanks

is it possible to combine FLA, AS3, and Flex?

$
0
0

Hi.  I have a concept for using assets created in the Flash GUI and stored as Library elements in the Flash GUI but accessed and manipulated via AS3?  The issue I have is the concept has to be developed in Flash Builder/Flex 4.7 so I'm trying to figure out if there's a way to export each FLA library element using some kind of automated process that will enumerate each object for easy scripting access via an AS3 Array or Array Collection in Flex.

 

Any examples on this?  Thanks in advance.


UDP video stream to Air for iOS - not working

$
0
0

Hi everyone.

 

My client has asked me to look at the possibility of writing an iOS app which will immediately start displaying a video from a UDP stream.

The emphasis here is on instant playback without load times, buffering, etc.

 

I'm using Flash Professional CS6, and Air for iOS (3.8).

 

THE PROBLEM -> Unfortunately, no matter what I have tried, I cannot get a video to display on my local development machine or test iPad.

I am using a simple FLV video which is streaming locally through VLC Media Player.

 

In actionscript, I am then connecting a DatagramSocket to this.

No problem here, as I can see that the DatagramSocket is reading in the video stream data when I run the following function:

 

private function dataReceived( event:DatagramSocketDataEvent ):void {

            //Read the data from the datagram

            txtHistory.appendText("\n Received from " + event.srcAddress + ":" + event.srcPort + "> " + event.data.readUTFBytes(event.data.bytesAvailable));

}

 

Ive made my complete AS3 file available for download here:

http://www.frogcdrom.com/clients/frog/UDPVidStreamReceiver.as

 

Please can anyone help me out?

Im pretty good with AS3, but pants at network stuff so totally out of my knowledge zone here.

But its a good job for a good client and ideally Id like to get it.

 

Thanks in advance of any help you can give.

Listen for value variable changing

$
0
0

Hi to everybody,
How can i create a listener for listening the change value of a variable?

exsample:
[code]
var obj : MyClass = new MyClass();

obj.myNumber = 10;


obj.addEventListener(MyEvent.CHANGE_VALUE, myFunc);


obj.myNumber = 25;
[/code]

1119: Access of possibly undefined property nameInput through a reference with static type Class.

$
0
0

Hi

 

I have had problems with the input code and keep getting this error: 1119: Access of possibly undefined property nameInput through a reference with static type Class.

 

The code is here below

 

 

function captureText():void

  {

   var myText = Page5.nameInput.text;

   Page6.nameOutput.text = "Hello "+myText+"!"

  }

 

Page 5 is the page the input is on

Page 6 is where the outpu is

nameInput and nameOutput are my text area and dynamic text boxes
Apparently they are static classes??

 

Any ideas will be greatfully appreciated

 

Thanks

How to Add XML Socket Policy Server?

$
0
0

So I'm making a TCP Socket Flash game, and I got it connected and working alright, it works fine over the LAN, but when I try to play with someone on a different router using Hamachi, the first message sends fine, but every additional message just throws the "Operation Attempted On Invalid Socket" error and it disconnects them. I'm assuming this is due to the socket policy server. I THOUGHT I added one correctly... but I guess I didn't? This is my code in the AIR server:

 

var security:URLLoader = new URLLoader();

var securityContent:XML;

security.load(new URLRequest("security-app.xml"));

security.addEventListener(Event.COMPLETE, loadComplete);

function loadComplete(e:Event):void

{

    securityContent = XML(security.data);

    securityContent.ignoreWhite = true;

    security.removeEventListener(Event.COMPLETE, loadComplete);

}

addEventListener(Event.ENTER_FRAME, loadComplete);

 

And this is the "security-app.xml" file:

 

<?xml version="1.0"?>

<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">

-<cross-domain-policy>

<allow-access-from to-ports="8080" domain="*"/>

</cross-domain-policy>

 

Is there something I did wrong? I've been looking around allover the internet for days but I can't seem to get an answer. Thanks.

Detects no microphone when using google Chrome browser

$
0
0

The code down bellow should detects the microphone. It works on all browser, but when i tested it on mac with latest google Chrome browser the flash player initially detects that no microphone. But when i click on the "reload button" on the browser then it does detect the mic.


 

var mic:Microphone = Microphone.getMicrophone();  try { prompt.text ="mic.name "+mic.name; trace("mic.name "+mic.name) } catch (e:Error) { prompt.text ="no mic detected"; trace("no mic detected") }

 

I heave searched google and spent many days trying to fix it... the only thing / way was to overcome this problem was to "reload" which is not that kind of fix we want.

Pleas help me out to fix it.. so it works like other browsers..


 

i'm using mac.

Viewing all 18626 articles
Browse latest View live


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