vendredi 30 septembre 2016

Re-wrapping a license in my AIR application

Okay so I'm currently working on a game in FlashDevelop, I'm compiling the game as a standalone AIR application as I have plans in the future of trying to see if I can go through Steam Greenlight.

The problem I'm facing is with the software license that gets automatically compiled into my game when I run the PackageApp.bat file (I'm using the AIR AS3 Projector project type). I've made some slight modifications to the default bat files, but I haven't touched them in such a long time that I actually forgot how I originally got the license to get compiled in the first place.

The license currently being compiled is the GNU Lesser General Public License, this went in line with how I envisioned my game to be at the time (many months ago). Now that I'm committed to getting my game on Steam I feel I need a stricter license, or at least not the LGPL. My game right now is open source but I think I'm going to go private once my game releases in beta.

Basically what I'm asking is if anyone knows how I can remove the automatic process of the PackageApp.bat compiling the LGPL with my standalone program. I've looked through all the bat files but there doesn't seem to be any obvious spot where the license is put in. I hope I'm not just dumb and am missing a simple solution. I can provide the code to the bat files if need be, thanks in advanced!

AdMob with actionscript 3

How I recognize if somebody clicks an ad in my game to give him coins or etc?
For example, if I say if you click the banner you earn coin or lifes or unlock a weapon.
Here is how i show an ad in the first frame in timeline.

import so.cuo.platform.admob.*;
Admob.getInstance().setKeys("your admob banner id","your admob institial id");
Admob.getInstance().showBanner(AdmobSize.BANNER_320x50,AdmobPosition.BOTTOM_CENTER);

How to make a True Random with equal chance in AS3?

I'm developing a rock-paper-scissor game player vs computer. There's nothing special except player playing 3 rounds per game.

I'm using this code to generate random number from 1 to 3

Math.floor(Math.random()*(1+3-1))+1

1 = Scissor, 2 = Paper, 3 = Rock

I'm not sure but this code favor on Number 2.

Meaning the computer generate Paper-Paper-Paper so the player notice it and taking the advantage and select scissor-scissor-scissor. I bet you will do it also.

How can I generate real random in AS3?

Can't Load Downloaded Swf Files to AIR App

I'm using MyFlashLab "Download Manager" ANE file for download SWF files to directories. (http://ift.tt/2dK1mhL)

I'm creating application for Android, it will load other downloaded swf files. (Interactive Book Application, load other books when user buy)

Download Manager ANE download my swf files to "/storage/emulated/0/downloads/" directory. But i cant load swf files to stage.

It create this error after loading: TypeError: Error #1009: Cannot access a property or method of a null object reference.

Any solution please write. Thank you

MY CODES:

var f:File = File.documentsDirectory;
f = f.resolvePath("downloads/test.swf");
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfComplete);
loader.load(new URLRequest(f.url));

public function swfComplete(e:Event){
       try{
          addChild(loader);
       }catch(err:Error){
           trace(err);
       }
}

Animation and shuffling list while drag in actionscript

I am trying to replicate the same in as3 , i have created it using a normal list , i tried my best to do it in FLEX , but no luck , my whole application is in flex , all i need is to animate the list while i drag and move along the list , I dont know where to start , i have tried a lots of things , but am out of luck and so desperate to ask people help through Stack overflow . Any help would be appreciated

enter image description here

Actionscript 3 add video admob

I have downloaded milkmangames and configured google admob interstitial. But I want earn Money with VideoAD (video that you have to watch for 30sec),and I can't do this with google. So is there a Way to do this in actionscript 3 and milkman? There is some tutorial about it?

jeudi 29 septembre 2016

How do you make buttons that have a specific length?

I'm having difficulty using a customlistrenderer class and homescreen class.

Here's my Homescreen class that contains the function generateData(), which is supposed to display a scroller of 22 buttons.

private function generateData(): void{

        var list: List = new List();
        list.width = 235;
        list.height = 380;
        list.name = "HomeScreenList";
        this.addChild(list);

        var rows:int = 6;
        var iterator:int = 0;
        var num:int = 22;
        var counter:int = 0;
        var obj:Object;
        var heroName:Array = ["ana", "bastion", "d.va", "genji", "hanzo", "junkrat", "lucio",
        "mccree", "mei", "mercy", "pharah", "reaper", "reinhardt", "roadhog", "soldier76", "symmetra",
        "torbjorn", "tracer", "widowmaker", "winston", "zarya", "zenyatta"];
        var temp:Array = []

        obj = new Object();
        while(iterator < rows){

        obj.name1 = heroName[counter];
        obj.image1 = myResource.getImage(heroName[counter]);
        obj.name2 = heroName[counter+1];
        obj.image2 = myResource.getImage(heroName[counter+1]);
        obj.name3 = heroName[counter+2];
        obj.image3 = myResource.getImage(heroName[counter+2]);
        obj.name4 = heroName[counter+3];
        obj.image4 = myResource.getImage(heroName[counter+3]);
        temp.push(obj);
        counter+4;
        iterator++;
        }

        var collection:ListCollection = new ListCollection(temp);

        //assign the renderer
        list.itemRendererType = CustomMenuListRenderer;
        list.dataProvider = collection;
        list.addEventListener(Event.CHANGE, onChange);

        this.addChild(list);
        list.validate();


    }

and the CustomMenuListRenderer class, under the initialize() function

super.initialize();
        firstButton = new Button();
        this.addChild(firstButton);
        firstButton.x = 20;
        firstButton.y = 100;
        firstButton.scale = 0.60;
        secondButton = new Button();
        secondButton.x = 92;
        secondButton.y = 100;
        secondButton.scale = 0.60;
        thirdButton = new Button();
        thirdButton.x = 163;
        thirdButton.y = 100;
        thirdButton.scale = 0.60;
        fourthButton = new Button();
        fourthButton.x = 235;
        fourthButton.y = 100;
        fourthButton.scale = 0.60;

        firstButton.addEventListener(Event.TRIGGERED, onTrigger);
        secondButton.addEventListener(Event.TRIGGERED, onTrigger);
        thirdButton.addEventListener(Event.TRIGGERED, onTrigger);
        fourthButton.addEventListener(Event.TRIGGERED, onTrigger);

The problem is since the loop displays the 4 buttons each loop, an error occurs at the 23rd button(since I only specified 22 buttons but I declared 4 buttons on the CustomMenuListRenderer class) in the 6th row.

My question is how do I fix this issue?

Accept drop of file on HTMLLoader

I have an HTMLLoader which loads a webpage in a desktop AIR with Apache Flex project. In this webpage is a submit button to upload a file. Users mostly use drag & drop to upload files from their desktop when they use the webpage in the browser so I would like them to have this same possibility in my application.

I have a listener for a NativeDragEnter event and in this even handler I accept a drag&drop operation on the HTMLLoader. The problem is that when the file is dropped on the HTMLLoader I get a "SecurityError file" error.

How can I make sure the file is accepted? Anyone know a solution to achieve this?

Flash as3 proper file path format to locate my script.php

What is the proper file path format to locate my script.php to a hosted website

please help me

Decoding Actionscript ByteArray using python

I am using actionscript to send an array to the server with this code(I am only writing that part of the code here):-

var a:ByteArray=new ByteArray;
a.writeObject({'a':'b','c':'d'});
socket.writeBytes(a);
socket.flush();

here I already opened a socket to a port on my server and I have a python code listenting on that port. How do I decode the bytes I receive using python when I run the swf after compiling it? I received the following in the server side:- b'\n\x0b\x01\x03c\x06\x03d\x03a\x06\x03b\x01'

why does the output comes undefined?-flash

I have an object name ball and ground and I'm trying to find the greatest distance between them but why does the value of "greatest" is always "undefined"?
Here's the code:

    var dt:Array = [];
    var greatest = 0;
    var i:int;
    var j:int;
    ball.addEventListener(Event.ENTER_FRAME, bg);
    function bg(event:Event)
    {
    d = Math.sqrt(ball.x-ground.x)*(ball.x * ground.x) + (ball.y - ground.y) * (ball.y - ground.y);

            for (i = 1; i < 1002; i++)
            {
                dt[i] = d;
            }
        for (j = 1; j < 1002; j++)
        {
            if(dt[j] > dt[j+1])
            {
                greatest = dt[j];
            }
            else
            {
                greatest = dt[(j+1)];
            }
        }
    }

How do we make an object/movie clip appear after 30 seconds

I am trying to make a quiz game in AS3; I had use the following code for keeping the points/scores

stop()

import flash.events.MouseEvent;
InstanceName.addEventListener(MouseEvent.CLICK, InstanceNameClick);
function change_bgClick(event:MouseEvent):void
{
    (root as MovieClip).InstanceName1.nextFrame();

But, how do I keep a timer?

For example: after 1 min, I need this to happend

INSTANCENAME2.visible = true;

Thank you.

Flex Error #2038 trying to uninstall Adobe AIR application in Mac

I'm trying to install a simple Flex AIR application in a Mac computer. Firstly, I tried the installation, but it failed at the end because the computer didn't have the latest Adobe AIR version (23.0.0).

After updating Adobe AIR, I tried the installation again and a pop up appears showing

The same version of the application you opened already exists on this system. Would you like to run the version already installed?

If I click on "Run now", nothing happens (because the application is not really installed in the computer), and if I click on "Uninstall", I receive a #2038 error (because the system is trying to uninstall an application that is not really installed).

If I install it on another Mac with no previous version of the installer, it installs fine. If I try to install the same application with a different name and Flex id version, it installs fine as well. Removing all installer files and reference files to the application in the computer does not fix the problem, nor does trashing the plist preferences file from the library.

Any ideas?

Encryption not returning value

package {
import flash.display.Sprite;
import flash.text.TextField;
public class FlashTest extends Sprite {
    public function FlashTest() {

        var tf:TextField = new TextField();
        tf.text=encrypt("test");
        tf.x = tf.y = 100;
        tf.height = 20;
        tf.background = true;
        tf.backgroundColor = 0xdddd;
        addChild(tf);



    const DELTA:int = -1640531527;



    const ROUNDS:int = 32;






   var key:String = "alphanumeric";



   var token:String = "alphanumeric01";



   function EncryptionHandler(param1:String = "alphanumeric", param2:String = "alphanumeric01")

  {

     key = param1;

     token = param2;

  }



   function encrypt(param1:String) : String

  {

     return _encrypt(param1,key,token);

  }



   function decrypt(param1:String) : String

  {

     return _decrypt(param1,key);

  }



   function setKeyTokenPair(param1:String, param2:String) : void

  {

     this.key = param1;

     this.token = param2;

  }



   function _encrypt(param1:String, param2:String, param3:String) : String

  {

     var _loc10_:* = NaN;

     if(param1.length == 0)

     {

        return "";

     }

     var _loc5_:Array = this.charsToLongs(this.strToChars(param1));

     var _loc9_:Array = this.charsToLongs(this.hexToChars(param2));

     var _loc8_:Number = _loc5_.length;

     if(_loc8_ % 2 == 1)

     {

        _loc8_++;

        _loc5_[_loc8_] = 0;

     }

     var _loc7_:Array = new Array(2);

     var _loc4_:Array = new Array(_loc5_.length);

     _loc10_ = 0;

     while(_loc10_ < _loc5_.length)

     {

        _loc7_ = this.mcrypt_encrypt(_loc9_,!!isNaN(_loc5_[_loc10_])?0:_loc5_[_loc10_],!!isNaN(_loc5_[_loc10_ + 1])?0:_loc5_[_loc10_ + 1]);

        _loc4_[_loc10_] = _loc7_[0];

        _loc4_[_loc10_ + 1] = _loc7_[1];

        _loc10_ = Number(_loc10_ + 2);

     }

     var _loc6_:String = this.charsToHex(this.longsToChars(_loc4_));

     return param3 + "" + _loc6_;

  }



   function mcrypt_encrypt(param1:Array, param2:Number, param3:Number) : Array

  {

     var _loc4_:* = 0;

     while(_loc4_ != -957401312)

     {

        param2 = Math.floor(param2 + ((param3 << 4 ^ param3 >>> 5) + param3 ^ _loc4_ + param1[_loc4_ & 3]));

        _loc4_ = Number(int(_loc4_ + -1640531527));

        param3 = Math.floor(param3 + ((param2 << 4 ^ param2 >>> 5) + param2 ^ _loc4_ + param1[_loc4_ >>> 11 & 3]));

     }

     return [param2,param3];

  }



   function mcrypt_decrypt(param1:Array, param2:Number, param3:Number) : Array

  {

     var _loc4_:* = -957401312;

     while(_loc4_)

     {

        param3 = int(param3 - ((param2 << 4 ^ param2 >>> 5) + param2 ^ _loc4_ + param1[_loc4_ >>> 11 & 3]));

        _loc4_ = Number(int(_loc4_ - -1640531527));

        param2 = int(param2 - ((param3 << 4 ^ param3 >>> 5) + param3 ^ _loc4_ + param1[_loc4_ & 3]));

     }

     return [param2,param3];

  }



   function _decrypt(param1:String, param2:String) : String

  {

     var _loc4_:* = null;

     var _loc6_:* = null;

     var _loc5_:* = null;

     var _loc3_:* = null;

     var _loc7_:* = NaN;

     if(param1.substr(0,1) == "<")

     {

        return param1;

     }

     if(param1.length == 0)

     {

        return "";

     }

     _loc4_ = this.charsToLongs(this.hexToChars(param1));

     _loc6_ = this.charsToLongs(this.hexToChars(param2));

     _loc5_ = new Array(2);

     _loc3_ = new Array(_loc4_.length);

     _loc7_ = 0;

     while(_loc7_ < _loc4_.length)

     {

        _loc5_ = this.mcrypt_decrypt(_loc6_,_loc4_[_loc7_],_loc4_[_loc7_ + 1]);

        _loc3_[_loc7_] = _loc5_[0];

        _loc3_[_loc7_ + 1] = _loc5_[1];

        _loc7_ = Number(_loc7_ + 2);

     }

     return this.charsToStr(this.longsToChars(_loc3_));

  }



   function charsToHex(param1:Array) : String

  {

     var _loc4_:* = NaN;

     var _loc2_:String = new String("");

     var _loc3_:Array = new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");

     _loc4_ = 0;

     while(_loc4_ < param1.length)

     {

        _loc2_ = _loc2_ + (_loc3_[param1[_loc4_] >> 4] + _loc3_[param1[_loc4_] & 15]);

        _loc4_++;

     }

     return _loc2_;

  }



   function hexToChars(param1:String) : Array

  {

     var _loc3_:Number = NaN;

     var _loc2_:Array = [];

     _loc3_ = param1.substr(0,2) == "0x"?2:0;

     while(_loc3_ < param1.length)

     {

        _loc2_.push(parseInt(param1.substr(_loc3_,2),16));

        _loc3_ = _loc3_ + 2;

     }

     return _loc2_;

  }



   function charsToLongs(param1:Array) : Array

  {

     var _loc9_:* = NaN;

     var _loc2_:Number = NaN;

     var _loc3_:Number = NaN;

     var _loc5_:Number = NaN;

     var _loc6_:Number = NaN;

     var _loc7_:Number = Math.ceil(param1.length / 4);

     var _loc4_:Array = [];

     var _loc8_:* = 0;

     _loc9_ = 0;

     while(_loc9_ < _loc7_)

     {

        _loc8_ = Number(_loc9_ * 4);

        _loc2_ = param1[_loc8_] == undefined?0:param1[_loc8_];

        _loc3_ = param1[_loc8_ + 1] == undefined?0:param1[_loc8_ + 1];

        _loc5_ = param1[_loc8_ + 2] == undefined?0:param1[_loc8_ + 2];

        _loc6_ = param1[_loc8_ + 3] == undefined?0:param1[_loc8_ + 3];

        _loc4_[_loc9_] = Number((_loc2_ << 24) + (_loc3_ << 16) + (_loc5_ << 8) + _loc6_);

        _loc9_++;

     }

     return _loc4_;

  }



   function longsToChars(param1:Array) : Array

  {

     var _loc4_:* = NaN;

     var _loc3_:Array = [];

     var _loc2_:Number = param1.length;

     var _loc5_:* = 0;

     _loc4_ = 0;

     while(_loc4_ < _loc2_)

     {

        _loc5_++;

        _loc3_[_loc5_] = param1[_loc4_] >>> 24 & 255;

        _loc5_++;

        _loc3_[_loc5_] = param1[_loc4_] >>> 16 & 255;

        _loc5_++;

        _loc3_[_loc5_] = param1[_loc4_] >>> 8 & 255;

        _loc5_++;

        _loc3_[_loc5_] = param1[_loc4_] & 255;

        _loc4_++;

     }

     return _loc3_;

  }



   function charsToStr(param1:Array) : String

  {

     var _loc4_:* = NaN;

     var _loc3_:String = new String();

     var _loc2_:Number = param1.length;

     _loc4_ = 0;

     while(_loc4_ < _loc2_)

     {

        _loc3_ = _loc3_ + String.fromCharCode(param1[_loc4_]);

        _loc4_++;

     }

     return _loc3_ as String;

  }



   function strToChars(param1:String) : Array

  {

     var _loc4_:* = NaN;

     var _loc3_:Array = [];

     var _loc2_:Number = param1.length;

     _loc4_ = 0;

     while(_loc4_ < _loc2_)

     {

        _loc3_.push(param1.charCodeAt(_loc4_));

        _loc4_++;

     }

     return _loc3_;

  }





   function changeKey(param1:String, param2:String) : String

  {

     return param1.substr(0,8) + param2.substr(8,24);

  }



   function toString() : String

  {

     return "[WIN_apiTEA]";

  }

    }
}}

I'm trying to get it to show the encrypted form of the "test" string. What am I doing wrong? This document is apart of a larger source but, I've omitted and crated this small sample. But, the same problem lies. When the encrypt, _encrypt, decrypt, _decrypt functions are called. They return nothing.

Scene navigation in adobe flash

I created a flash file contained 2 scenes, "Wheel_Slide_In" and "Wheel_Rotate". mu goal is to play scene "Wheel_Rotate" after "Wheel_Slide_In" finish playing. I put this codes in the last frame of "Wheel_Slide_In" :

//gotoAndPlay(1,"Wheel_Rotate");
//gotoAndStop(1,"Wheel_Rotate");
//MovieClip(parent).gotoAndPlay(1, "Wheel_Rotate");

and many many other random! combinations with parent and root to tell the flash this simple task!

Hey dear Flash, please play "Wheel_Rotate" Scene after "Wheel_Slide_In" Scene! Simplz! unfortunately, I and Flash don't talk the same language! could you please help me to write the correct code and understand how you play another scene from a different one?

many thanks

mercredi 28 septembre 2016

Split is not a function?

I have this code I was testing with:

var test:String="Hello there; im zane"
var parts:Array=test.split(";");
trace(parts)
trace(parts[0])
var randomnum:Number=0; 
stage.addEventListener(Event.ENTER_FRAME, code)
function code(c:Event):void{
    if(parts[randomnum] != undefined && parts[randomnum] != null){
        parts[randomnum]=parts[randomnum].split(" "); 
        randomnum+=1
        trace(parts[randomnum])
        }
    else{
        randomnum=0
        }
}

And there is an error with this parts[randomnum]=parts[randomnum].split(" ");. Flash says that split is not a function (

TypeError: Error #1006: split is not a function. at Untitled_fla::MainTimeline/code()

)

Earlier in this project, I used the split function with a different part of the variable, and I also tried parts[0]=parts[0].split(" ") out of the event and it worked fine.

What I'm trying to find out is, why does a split command not work in this scenario? Am I doing something wrong?

How can I embed an swf in a vb form without loosing functionality?

I have an swf which I want to embed in a vb form. the swf is on a url like http://siteurl.com/subdir/file.swf my problem is when I embed the swf in the form it does not allow for communication with sql through php.

I made a very lenient crossdomain.xml

<?xml version="1.0"?>

<site-control permitted-cross-domain-policies="all"/>

<allow-access-from domain="*" secure="false"/>

<allow-http-request-headers-from domain="*" headers="*" secure="false"/>

and set the flash local playback security under the publish settings to access network only. but still no luck. Is what Im trying to do possible?, or am I going the wrong rout with this?

also I know the crossdomain.xml is very poorly setup, just trying everything to see if I can get it working at all really haha.

PS: I have had a couple badly received questions, not sure why. but if someone can tell me what I am doing wrong that would be great.

AS3 MediaPromise for CameraUI doesn't get back to me on iOS

I need to capture an image using CameraUI on AS3/Air/Starling framework. I get the CameraUI, it opens, the image gets selected and I receive a MediaPromise object.

The samples in the documentation mentions the following code to capture the Image from an async media promise on iOS but I do not hear any callbacks in neither onMediaLoaded function nor the ioError function.

BTW the log line "Asynchronous Mode Media Promise." is displayed when I choose a photo.

private function imageSelected(evt:MediaEvent):void
{
    this.feedbackText.text = "Image Selected\n";

    // Create a new imagePromise
    var imagePromise:MediaPromise = evt.data;

    // Open our data source
    dataSource = imagePromise.open();

    if(imagePromise.isAsync)
    {
        this.feedbackText.text += "Asynchronous Mode Media Promise.\n";

        var eventSource:IEventDispatcher = dataSource as IEventDispatcher;

        eventSource.addEventListener( Event.COMPLETE, onMediaLoaded );
        eventSource.addEventListener( IOErrorEvent.IO_ERROR, ioError );
    }
    else
    {
        this.feedbackText.text += "Synchronous Mode Media Promise.\n";
        readMediaData();
    }
}

How to generate dynamic linked lists in actionscript 3

i am sitting on a problem. I am learning linked lists (beacuse i need this lateron for a tree solution) and try to create the links dynamically. Obviously i have the problem to generate the linkage between the objects.

Here is the Code

public function Main()
    {
        var node1:Object = {value: 1};
        var node2:Object = {value: "foo"};
        var node3:Object = {value: "bar"};
        var node4:Object = {value: "test"};
        var node:Object = {};

        for (var a:int = 1; a < 4 ; a++)
        {
            if (a < 3)
            {
            node[a].next = node1[a + 1];
            }
            else
            {
                node1[4].next = null;
            }

        }
        // ((node1.next = node2).next = node3).next = null; works, but 
        // not for the code above


        var n:Object = node1;
        while (n)
        {
            trace(n.value);
            var jsonString:String = JSON.stringify(n);
            trace(jsonString);

            n = n.next;
        }
    }

Can i have a explanation please ?

AIR for iOS, external SWF, can instance coordinates be accessible?

I need to do the following: AIR for iOS app Load an external SWF from network (not compiled with the main swf), and access instances positioned on the stage. Or instances positioned in a class exported for actionscript. Do instance names count as unloadable ABC?

Thanks

Flash builder vs Flashdevelop full screen size

I have created movieclip 480x800 screen size and exsport swc file with flash cs6. Flash builder import swc file and test run my device (Lg l70, 480x800) not full screen, but flashdevelop import and test run it is full screen. How can I full screen for flash builder

Flash Builder not full screen (gray area)

enter image description here

Flashdevelop full size

Flashdevelop screen size

How to get IDFV with ActionScript?

I want to get IDFV value in my ActionScript code.

How would I do it?

p.s. I have ANE to get IDFA, but I cannot find any solution for IDFV

mardi 27 septembre 2016

Regex for particular pattern with spaces

The pattern i need to check is "1w 1d 1h 1m 1s", with some restrictions, for example there can be only 1 to 3 numbers in each section, any section can be missing, there can be any numbers or spaces and other white space characters between the parts, the parts must be in order. I wrote a basic regex for it:

^((?:\s*\d{1,3}[wW]\s*)?(?:\s+\d{1,3}[dD]\s*)?(?:\s+\d{1,3}[hH]\s*)?(?:\s+\d{1,3}[mM]\s*)?(?:\s+\d{1,3}[sS]\s*)?)$

Now the problem - I got stuck, because if I write "1d 1h" - it wont pass, because it requires a space before "1d", but I cant not have that space, "1w1d" should be incorrect. Using regex conditions is not really an option.

Detect what variable is being changed AS3

I am not currently working on a project, but I wanted to know this: Can you detect what variable you are changing, and use it to change the variable?

This is a test project I made

var code:String="hello there; hi human"
var parts:Array = code.split(";");
parts[0] = parts[0].split(" ")
parts[1] = parts[1].split(" ")
trace(parts[0] [1])

But could I, instead of this part:

parts[0] = parts[0].split(" ")
parts[1] = parts[1].split(" ")

add something to make it automatically put parts[correctnumber] for each one?

For example, could I make it so testvar[x] = testvar[x] with the x being any number?

If I am not clear, tell me.

Trying to find an AS3 formula to convert decimal coordinates to minutes

I've got my AIR app that displays the current location of the user like :

lat : -22.14354 long : 166.4256

I'm looking for a formula that can convert these coordinates to Degrees Minutes Seconds (the result would be, for this example, : lat : -22° 8' 36.744" / long : 166° 25' 32.16")

Any idea where I could find this formula (in AS3) ?

Thx

Adobe Air Can't Connect to Server on iOS10

I have an application on Appstore like 2 years. I developed with Adobe AIR.

On iOS10 my app not working. Can't connect to http links.

I debug and get error from connections: Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: http://ift.tt/2dxCeIh

I used HTTPStatusEvent.HTTP_STATUS for understand any solution, it gives 0

Any methods to solve?

MY CODE:

var urlReq:URLRequest = new URLRequest ("http://ift.tt/2dxCeIh");            
urlReq.method = URLRequestMethod.POST;          
var urlVars:URLVariables = new URLVariables();          
urlVars.user_id = Main.instance.userID;     
urlReq.data = urlVars; 


var loader:URLLoader = new URLLoader (urlReq);
loader.addEventListener(Event.COMPLETE, onCreditComplete);


loader.addEventListener(HTTPStatusEvent.HTTP_RESPONSE_STATUS, httpStatusHandler);
loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);


loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.load(urlReq);

what do i replace 'addFrameScript' with in object oriented as3?

im converting the code from this post to my main class. another class, which contains a clip, is passed through an array and played with playScene()...

public class Main extends MovieClip
    {
        private var myInterface:ui;
        private var playQueue:Array = new Array();

        public function Main()
        {
            trace("main is working");

            playQueue = [open_door];
            playScene();
        }

        public function playScene():void
        {
            //if there was an item previously playing (currentClip has a value), stop it and remove it.
            if(currentClip){
                currentClip.stop(); 
                currentClip.addFrameScript(currentClip.totalFrames-1, null); 
                currentClip.parent.removeChild(currentClip);
            }  

            //check if there's anything left to play
            if(playQueue.length < 1) {
                return;
            }

            trace(playQueue);
            trace(playQueue.length);

            var nextItem:* = playQueue.shift();

            if(nextItem is Class){
                //if it's a class, provide an instance of it
                var currentClip = new nextItem();
            }else{
                var currentClip = MovieClip(nextItem);
            }


            addChild(currentClip);
            currentClip.x = 412.4;
            currentClip.y = 244.5;
            currentClip.gotoAndPlay(1);

            //add a command on the last frame of the movie clip to play the next item in the queue
            currentClip.addFrameScript(currentClip.totalFrames-1, playScene);
        }

    }
}

the clip plays fine, but it loops forever. when this function was timeline code, that .addFrameScript line added a piece of code to the last frame of the currentClip's timeline. now that currentClip stems from a class, the timeline code doesn't seem to apply anymore... what am I supposed to replace it with? how does OOP relate to object timelines?

What happens if I iterate over the return from a function call?

function buildArray():Array {
    return new Array([1, 2, 3, 4]);
}

for each (var element:Number in buildArray()) {
    // Do stuff
}

I've managed to find a blog post saying that in the above case, the result of buildArray() will be cached, so it won't be called multiple times. When I step through in the debugger, it only gets called the first time, but I don't know that that behavior isn't implementation specific. So specific question:

Can it be guaranteed that a function called in a loop like this will only be evaluated the first time? And is there some official reference confirming this?

How to connect to a TCP server from an AIR Android App?

I am working on a Home Automation system using the ESP8266 device. I build a simple program on AIR Desktop to connect to the ESP8266 and send strings to it. Here is the code:

package 
{ 
   import flash.display.Sprite; 
   import flash.events.Event; 
   import flash.events.IOErrorEvent; 
   import flash.events.ProgressEvent; 
   import flash.events.ServerSocketConnectEvent; 
   import flash.net.ServerSocket; 
   import flash.net.Socket; 
   import flash.events.MouseEvent;
   import flash.utils.ByteArray;
   import flash.security.*;

  public class main extends Sprite 
 { 
    private var serverURL:String; 
    private var portNumber:int; 
    private var socket:Socket; 
    private var state:int = 0;
    private var msg:ByteArray;

    public function main() 
    { 

        send_btn.addEventListener(MouseEvent.CLICK, onSendMessage, false, 0, true);
        Telnet("192.168.0.113", 90)

    } 

    public function Telnet(server:String, port:int) 
    { 
        serverURL = server; 
        portNumber = port; 
        socket = new Socket(); 
        socket.addEventListener(Event.CONNECT, connectHandler); 

        //socket.addEventListener(ProgressEvent.SOCKET_DATA, dataHandler); 
        ///Security.loadPolicyFile("http://" + serverURL + "/crossdomain.xml"); 
        try 
        { 
            trace("Trying to connect to " + serverURL + ":" + portNumber + "\n"); 
            socket.connect(serverURL, portNumber); 
        } 
        catch (error:Error) 
        { 
            trace(error.message + "\n"); 
            socket.close(); 
        } 
    }

    public function connectHandler(e:Event):void
    {
        trace("Connected Successfuly.");
    }

    public function writeBytesToSocket(ba:ByteArray):void 
    { 

        socket.writeBytes(ba); 
        socket.flush(); 
    }



    private function onSendMessage(e:MouseEvent):void
    {
        msg = new ByteArray();
        msg.writeUTFBytes(msg_txt.text);
        writeBytesToSocket(msg);

    }
 }
}

While running the project on my Laptop, everything works fine. I can connect the device and send strings as well. Then I published as an AIR Android project and installed the apk on BlueStacks, it still worked as expected. But when I installed the apk on my android phone, it doesn't seem to work.

Any help is greatly appreciated.

Flash Builder debugger failed to connect to the running application with tomcat

I had look into similar question in the stack overflow and tried all the solutions given there, but nothing works for me.

I have a Flex Web application running in localhost with tomcat, i have used Mongrel plugin in Flash Builder to run tomcat.

I am using Firefox browser.

when i try to debug my application it is throwing below error

The Flash Builder debugger failed to connect to the running application.

Ensure that:

1. For in-browser applications, you are running the debugger version of Flash Player.

2. For network debugging on a mobile device, you have a reliable network connection to the device, and port 7935 is open on your machine's firewall.
    Device connection help

click here for error screenshot

I did check with netstat for port 7935 and there is no service running on this port.

I also added the solutions in catalina.properties file as suggested by others in related question but it did not worked out.

kindly help me fix this problem.

Thanks in advance!

AdMob in Animate CC

I build my apps with Adobe Animate CC and its the first time trying to show ads in my app but i cant find something to explain that from the begin!
I must to add something to the apps code?
I must to add something to XML file?
The application must be published or i can use ads before i publish my app?
Is there a good tutorial step by step for helping me?
I try already admob ane but i didn't get it!
Also what is the SDK? i cant find it anywhere to download it!

How to save multiple movie clip into an image air for android

I am creating a dress-up game, where the dynamic movie clip can also be save as an image. Unfortunately, I was only able to save the image of 1 movie clip. Can anyone please help. I am new to flash. Thanks

Here is my code:

function fl_ClickToGoToAndStopAtFrame_18(event:MouseEvent):void
   {

GirlDone_btn.removeEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_18);
GirlDone_btn.visible = false;
var jpgSource:BitmapData = new BitmapData(480, 386.15, false);
jpgSource.draw(GirlBg_mc); 
var jpgEncoder:JPGEncoder = new JPGEncoder(100); 
var imgByteData:ByteArray = jpgEncoder.encode(jpgSource);

var file = new FileReference();

file.save(imgByteData, ".jpg");

if( CameraRoll.supportsAddBitmapData ){
new CameraRoll().addBitmapData(jpgSource);
GirlDone_btn.visible = true;
GirlDone_btn.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_18);

}
}

Pause a movement by accelerometer with ActionScript 3

So basically, I have a Tetris game code that make a movement by accelerometer, but the thing is, it couldn't stop moving until i get back to original position which is not okay.

Here is the code:

private function MTetromino(evt:Event)
    {
        if (! gameOver)
        {
            /*====== MOVE X =======*/
            if (accX > 0.3 && canFit(tRow,tCol - 1,currentRotation))
            {
                tCol--;
                placeTetromino();

            }
            else if (accX < -0.3 && canFit(tRow,tCol + 1,currentRotation))
            {
                tCol++;
                placeTetromino();
            }

            /*====== MOVE Y =======*/
            if (accY < -0.15 && canFit(tRow,tCol,rot))
            {
                var ct:uint = currentRotation;
                var rot:uint = (ct + 1) % tetrominoes[currentTetromino].length;
                currentRotation = rot;
                removeChild(tetromino);
                drawTetromino();
                placeTetromino();

            }
            else if (accY > 0.15 && canFit(tRow + 1,tCol,currentRotation))
            {
                tRow++;
                placeTetromino();

            }
        }
    }

I need a pause code or can make the tetromino move one time every tilt position. Please help, and thank you in advance for your answers.

lundi 26 septembre 2016

How to connect and send message to a Wifi network from an AIR App?

I am interested in communicating with the ESP8266 device from and AIR App. I don't really know what to search for. There are Native Extensions to connect to networks but I havn't found a way to send messages. Is there a way? Just a direction would be enough.

Resize and load External SWF in full screen using AS3 in AIR

I'm noob at programing and I'm working with Flash Pro to develop an APP for android, and I have a problem to resize an external SWF to be displayed in full screen in left. First thing in my *.Fla project I have a button in "Scene 1" that can run a "Scene 2" using this code:

    stop()
    play_btn.addEventListener(MouseEvent.CLICK, play_SWF);
    function play_SWF(event:MouseEvent):void
    {
    gotoAndPlay(1,"Scene 2");   
    }

The "Scene 2" should resize and display the external SWF in full screen and this is the code I'm trying:

    import flash.events.Event;
    import flash.events.IOErrorEvent;
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.display.Loader;
    stop()
    var swfLoader = new Loader();
    var urlReq: URLRequest = new URLRequest("myfile.swf");
    stage.displayState = StageDisplayState.FULL_SCREEN;
    stage.align = StageAlign.LEFT;
    swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoadComplete);
    swfLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, swfLoadError);
    swfLoader.load(urlReq);
    function swfLoadComplete(evt: Event): void {
    var loader: Loader = Loader(evt.target.loader);
    add hold(loader.content);
    swfLoader.width = stage.stageWidth;
    swfLoader.height = stage.stageHeight;
    swfLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, swfLoadComplete);
    }
    function swfLoadError(evt: IOErrorEvent): void {
    trace("Unable to load swf ");
  swfLoader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, swfLoadError);
    }

The problem is that the external flash file displayed small in the top left of stage. Please can someone help :/

How to Find Certain Areas of a Variable AS3

I do not have a project or anything, I just wanted to know if this was possible.

Let's say I have a variable that is a string,

var code:String="hello there"

is there any way possible I could keep that variable the same, while using it for only the first 10 letters (or any number of letters)?

For example, if I had 2 dynamic textboxes, could I assign one the first four letters of the variable, and the other one the last four letters of the variable?

Also, could I recognize a charCode and make that the endpoint? For example, could I recognize when a space occurs, and do all letters before that?

Thanks in advance.

Syntax to transcode and stream video to stdout?

I'm trying to transcode and stream video from VLC to stdout. I've searched all around and I think I am close but something isn't right.

This is in Actionscript for an AIR app but that might not be significant. I am using VLC in "Remote Control" mode and am able to communicate with it through stdin to start and stop the stream. I am also getting data on stdout but it appears to be empty bytes.

I don't want to clog this question up with too much code so ask if you have any questions and I will fill in the details.

Skipping the Actionscript specific parts, these are the arguments I am sending to VLC – first to transcode to FLV:

processArgs = new Vector.<String>();
processArgs.push("-I rc");
processArgs.push("-vvv");
processArgs.push("--sout");
processArgs.push("#transcode{vcodec=FLV1,acodec=mp3}:standard{access=file,mux=ffmpeg{mux=flv}, dst=-}");

I have also tried variations on that:

processArgs.push("#transcode{vcodec=FLV1,vb=512,width=640,height=480,acodec=mp3,ab=128,samplerate=44100,channels=2}:gather:std{access=file,mux=flv,dst=-}");

And for .mp4:

processArgs.push("#transcode{vcodec=mp4v,acodec=mp4a}:std{access=file,mux=mp4,dst=-}"); 

After this set up I use the "add" rc command to add and then play a file.

process.standardInput.writeUTFBytes("add " + videoPath + " \n" );
process.standardInput.writeUTFBytes("play" + "\n" );

I can see data coming through and a snippet of the VLC debug info is below. It looks like I have things set up correctly but the data appears to be empty. Am I missing a step or parameter?


Partial VLC debug info for the mp4 pass:

[0000000105e02728] stream_out_transcode stream out debug: decoder aspect is 1.734417:1
[0000000105e02728] stream_out_transcode stream out debug: source pixel aspect is 0.975610:1
[0000000105e02728] stream_out_transcode stream out debug: scaled pixel aspect is 0.975610:1
[0000000105e02728] stream_out_transcode stream out debug: source 1280x720, destination 1280x720
[0000000105e02728] stream_out_transcode stream out debug: source fps 30/1, destination 30/1
[0000000105e02728] stream_out_transcode stream out: input interval 33333 (base 1)
[0000000105e02728] stream_out_transcode stream out: output interval 33333 (base 1)
[0000000105e02728] stream_out_transcode stream out debug: encoder aspect is 1280:738
[0000000105e02728] stream_out_transcode stream out debug: destination (after video filters) 1280x738
[00000001008408b8] core encoder debug: looking for encoder module matching "any": 19 candidates
[00000001008408b8] avcodec encoder debug: CPU flags: 0x0107d3db
[00000001008408b8] avcodec encoder debug: Time base for probing setted to 1/30
[00000001008408b8] avcodec encoder debug: Time base set to 1/30
[00000001008408b8] avcodec encoder debug: found encoder MPEG-4 Video
[00000001008408b8] core encoder debug: using encoder module "avcodec"
[0000000108600178] core mux debug: adding a new input
[0000000108600178] mux_mp4 mux debug: adding input

Bike Customization using flash as3

i am developing a Bike customization using flash as3 for my Bike shop website.

and there is a function that's really need to my customization which is the adding a products to choose more items to my customization but i dont know how to make it.imgay

as3 dynamic TextField words from array placed into individual MovieClips into a sentence

I am trying to create a dynamic sentence from an array of words. The words need to be placed next to each other in a sentence. I need the words to be in a movie clip so I can drag them as well.

Below is the code I am using but I am having many issues. Any ideas?

package com.sentances {

    import flash.display.MovieClip;
    import flash.display.*;
    import flash.text.*;
    import flash.events.*;


    public class Main_Sentances extends MovieClip {


        public var Sentance: Array;
        public var myText: TextField;
        public var myMovie: MovieClip;

        public var Words: Array = new Array("This", "is", "my", "sentance.");

        public function Main_Sentances() {
            // constructor code

            MakeWords();
        }


        public function MakeWords() {
            var xSpot = 0;
            for (var i = 0; i < Words.length; i++) {
                //trace(Words[i]);

                myMovie = new MovieClip();
                myMovie.name = Words[i];
                addChild(myMovie);

                myText = new TextField();
                myText.selectable = false;
                myText.border = true;
                myText.defaultTextFormat = new TextFormat('Verdana', 50, 0xffffff);
                myText.text = Words[i];

                //trace(myText.name);

                myText.addEventListener(Event.ADDED_TO_STAGE, handleChng);
                myMovie.addChild(myText);               







                function handleChng(e: Event): void {
                    trace("childMC ADDED_TO_STAGE");
                        trace(myText.textWidth);

                        if(i==0)
                        {
                        myMovie.x = 0;
                        myMovie.width = myText.textWidth;
                        myMovie.height = myText.textHeight;
                        xSpot = myText.textWidth;
                        }
                        else
                        {
                        myMovie.width = myText.textWidth;
                        myMovie.height = myText.textHeight;
                        xSpot = xSpot + myText.textWidth;
                        myMovie.x = xSpot;
                        }
                }

            }




        }


        // End Package  
    }
} 

dimanche 25 septembre 2016

Debug Adobe Air app on Android without erasing app data

I need to debug a new version of an Adobe Air app on Android. This has to be not a "clean install", but an actual update so that all the data is preserved from the previous version. Debugging from Animate CC (formerly Flash Professional) automatically deletes the app and data. Is there a way circumvent that?

can action Script 3.0 do that work?

i want to develop an app to load and play video from popular video sharing service like :

letwatch.to
watchers.to

And play the videos in air application ...

The Question is : can as3.0 do that ? if Not ? what i should do ? and what i should Learn ? Thanks ...

i see in android application the developer ask you to choose a server to play the video after while the video auto start from an embedded html link :

......................... End .......................

samedi 24 septembre 2016

actionscript 3 two class two stage one movieclip

I have 1 classA in stage1 and 1 classB in stage2. On stage1 there is a movieclip instance name MC. On stage2 there is a movieclip instance name MC (same instance name as stage1).

classA:

package {

    public class classA extends MovieClip {

    public function classA(): void {

        }
        public function prenditutti(obj: MovieClip): void{
            //mc is movieclip in stage1 and work correctly
            MC.addChild(obj);
       }
    }
}

classB: (I use it in stage2 and there is a movieclip instance, like in stage1, named mc)

package {

    import livingroom;

    public class classB extends MovieClip {
        //calamita_inventario is a movieclip linkage in library
        public var calamita_inv_cost: calamita_inventario = new calamita_inventario(); 

        public var LR: classA = new classA();

        public function classB() {
            // constructor code
        }

        public function prendicalamita(e: MouseEvent) {
            LR.prenditutti(calamita_inv_cost);
            //I should see in stage2 inside a MC my movieclip calamita_inv_cost, but doesn't work.
        }
    }
}

But in stage2 i can't see addChild. need help

vendredi 23 septembre 2016

how can I linearize this recursive decryption script into another language?

background: I have access to a SWF that uses encrypted data and I want to make a different application on a better platform than Flash. I have the keys, the encrypted data, and the SWF that does stuff with it.

my goal: to write a small program in another language (Python would be nice, but really ANYTHING but Flash) that will output the decrypted data so I can use it elsewhere.

my problem: I cannot figure out exactly what this bloody Flash file is doing when it decrypts, so I can't reproduce it.

Sample encrypted data:

QpzoMekuKadBaZLp5IfQoQJ2JTl91y1yAsARHN4p5JA\/Ilf9CwQVsgtVEQ6QaG7dkgYi77NGrA+\/9Hv1dB0i0iuf77bEWqyWqqufhPrYaIlH3nOaaP8yl5ubIyn9\/+Cb

The actionscript I cannot translate:

package crypto
{
   import com.hurlant.util.Hex;
   import flash.utils.ByteArray;
   import com.hurlant.util.Base64;
   import com.hurlant.crypto.symmetric.PKCS5;
   import com.hurlant.crypto.symmetric.IPad;
   import com.hurlant.crypto.Crypto;
   import com.hurlant.crypto.symmetric.ICipher;
   import com.hurlant.crypto.symmetric.IVMode;
   import utils.JsonUtils;
   public class ImAES
   {
      private static var key:String = "F1BBCA4A0CFF8151";
      private static var B64IV:String = "29148FB1C5639A22";
      public static var jsonDecode:Boolean;
      public static var gzipped:Boolean = true;
      public function ImAES()
      {
         super();
      }
      public static function setKey(param1:String) : void
      {
         ImAES.key = param1;
      }
      public static function setIV(param1:String) : void
      {
         ImAES.B64IV = param1;
      }
      public static function init(param1:String) : void
      {
      }
      public static function decrypt(param1:String) : Object
      {
         var _loc6_:* = null;
         var _loc5_:ByteArray = Hex.toArray(Hex.fromString(key));
         var _loc4_:ByteArray = Base64.decodeToByteArray(param1);
         var _loc3_:IPad = new PKCS5();
         var _loc2_:ICipher = Crypto.getCipher("aes-cbc",_loc5_,_loc3_);
         if(_loc2_ is IVMode)
         {
            _loc6_ = _loc2_ as IVMode;
            _loc6_.IV = Hex.toArray(Hex.fromString(B64IV));
         }
         _loc3_.setBlockSize(_loc2_.getBlockSize());
         _loc2_.decrypt(_loc4_);
         if(gzipped)
         {
            _loc4_.uncompress();
         }
         var _loc7_:String = _loc4_.toString();
         if(jsonDecode)
         {
            return JsonUtils.decode(_loc7_);
         }
         return _loc7_;
      }
   }
}

My specific question: how can I recreate these decryption steps in a more usable programming language? If the actionscript was linear I think I could figure it out, but the recursion (decrypt calls decrypt) has me stumped.

Converting AS3.0 to HTML5

The situation is I have aworking AS3 animation with some basic actions, I need to embed in a HTML5 Captivate (this is what I'm good at, as you can tell its not coding). I attempted (poorly) to use the http://ift.tt/2cTkJWN to convert to HTML5. The first first keyframe is the loader from AS3, the second key frame is has some animations that are actioned by a button and the 3rd is the animation. Any help with the below would be massively appreciated.

At the moment the canavs is loading blank so i can't even tet teh button works.

What is the easiest changes I can make to this action on keyframe 1 so it jumps to the play (I don't need a loader as HTML5)?

this.stop();
this.addEventListener(Event.ENTER_FRAME, this.loading);

function loading(Event):{
var total = this.stage.loaderInfo.bytesTotal;
var loaded = this.stage.loaderInfo.bytesLoaded;

 if (total == loaded){
  this.removeEventListener(Event.ENTER_FRAME, this.loading);
  this.gotoAndPlay(3);
 }
}

Working AS3 from keyframe 1:

stop();
this.addEventListener(Event.ENTER_FRAME, loading);
function loading(e:Event):void{
var total:Number = this.stage.loaderInfo.bytesTotal;
var loaded:Number = this.stage.loaderInfo.bytesLoaded;
 if (total == loaded){
  this.removeEventListener(Event.ENTER_FRAME, loading);
  this.gotoAndPlay(3);
 }
}

Animations, I think there is no change here:

mouthmc.play();
eyesmc.play();

Button, I think I converted this OK?:

textmc.mouseEnabled = false;
    this.theButton.addEventListener("click", clickHandler(this));  
    function clickHandler()
    {
        planeflightmc.gotoAndPlay("end");
     cloudmc.gotoAndStop(1);
     this.gotoAndStop(3);
    }

Note all editing is in Animate CC

Unable to addChild on MouseCoordinations

What i am trying to do is, to place a new tower each time on MouseX and MouseY.. but it seems it isn't working Any Idea guys?

or if you can create a tileMap array and add new child of PrototypeTower each time when we click on the Tower (on x=50, y=400) to select and place wherever we want

Main.as

package
{
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.ui.Mouse;

    public class Main extends Sprite 
    {
        private var  pTower:PrototypeTower = new PrototypeTower;
        private var zTower:PrototypeTower = new PrototypeTower;
        private var fTower:PrototypeTower = new PrototypeTower;
        public function Main() 
        {
            pTower.x = 50;
            pTower.y = 400;
            addChild(pTower);

            addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
        }
        private function onAddedToStage(e:Event):void
        {
            removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);

            pTower.addEventListener(MouseEvent.CLICK, onClicked);
        }
        private function onClicked(e:Event):void
        {
            removeEventListener(MouseEvent.CLICK, onClicked);

            zTower.startDrag();
            zTower.x = mouseX;
            zTower.y = mouseY;
            addChild(zTower);

            addEventListener(MouseEvent.CLICK, onPlaced);
        }
        private function onPlaced(e:Event):void
        {
            removeEventListener(MouseEvent.CLICK, onPlaced);
            zTower.stopDrag();
            fTower.x = mouseX
            fTower.y = mouseY;

            addChild(fTower);

        }
    }
}

PrototypeTower.as

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

    public class PrototypeTower extends MovieClip 
    {   
        public function PrototypeTower() 
        {
            this.graphics.beginFill(0x00FF00);
            this.graphics.drawRect(this.x, this.y, 20, 20);
            this.graphics.endFill();
        }
    }
}

Thank you, i am totally noob, wondering around from days!

issue with connecting to Wowza server from other computer in local network

I have Wowza server (trial version) installed on my local computer connected to local network. In FlashDevelop I have also two small AS3 project: one is concerned with upstream process and the second with downstream process.(flashdevelop produces html file containing swf file, so I start downstream and upstream procces from browser). Ip adress of wowza server in my local network is : 192.168.0.101 and I use this adres in AS3 code. Everything works fine (I can publish and receive stream) if I start all stuff on the same computer where is wowza an web server installed. But if I start downstream proces in browser from other computer in my local network, It doesn't work. I check all hosts with ping and everything works. So What i do wrong?

Possible color error in AS3

I wrote an AS3 program (.swf output) about a board moving with the mouse, but when I set the color to blue, the result is a yellow outer area of the board surrounding the blue inner area. It only becomes totally blue when the user click the screen. How can I modify the program so that the board becomes blue at the start of the program without clicking once? The program is uploaded onto this link : http://ift.tt/2d5UsRE

And here is the source code, all of it.

package 
{
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    public class FlashTest extends Sprite 
    {
        public var board:Sprite;
        public function FlashTest() 
        {
            board = new Sprite();
            addChild(board);
            board.graphics.beginFill(0x0099ff);
            board.graphics.drawRect(0,stage.stageWidth-20,100,10);
            board.graphics.endFill();
            board.x = stage.stageWidth /2 - board.width/2;
            stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseEvent);
            stage.focus = board;
        }
        public function onMouseEvent(event:MouseEvent):void
        {
            board.x = event.localX - board.width/2;
            if(board.x <0)
                board.x = 0;
            if(board.x > stage.stageWidth - board.width)
                board.x = stage.stageWidth - board.width;
        }
    }
}

Converting AS3.0 to HTML5

I'm using Adobe Flash Pro CC, and nothing is loading into the canvas, I know its my loader, but not sure what I have done wrong:

this.stop();
this.addEventListener(Event.ENTER_FRAME, this.loading);

private function loading():{
var total:Number = this.stage.loaderInfo.bytesTotal;
var loaded:Number = this.stage.loaderInfo.bytesLoaded;

    if (total == loaded){
        this.removeEventListener(Event.ENTER_FRAME, this.loading);
        this.gotoAndPlay(3);
    }

}

This was the AS3

stop();
this.addEventListener(Event.ENTER_FRAME, loading);

function loading(e:Event):void{
var total:Number = this.stage.loaderInfo.bytesTotal;
var loaded:Number = this.stage.loaderInfo.bytesLoaded;

    if (total == loaded){
        this.removeEventListener(Event.ENTER_FRAME, loading);
        this.gotoAndPlay(3);
    }

}

Enemy AI first person

I'm wanting to make a game where you can fight jason in first person but at the beginning you have to block. jason stands in front of you holding his machete ready to swing and you have to block him or else you get hit. I'm not sure how to code this particular thing because I don't know much about first person in flash.

jeudi 22 septembre 2016

I need help converting some AS1.0 to AS3.0

I have a basic animation made in AS1.0 that needs to be exported to HTML5 but I need to convert the AS1.0 to As3.0 first:

LOADED = Math.round(getBytesLoaded());
TOTAL = Math.round(getBytesTotal());
PERCENT = LOADED/TOTAL
BAR._width=PERCENT*199
if(LOADED==TOTAL {gotoAndPlay(3);}

Any help appreciated

How to make a list of loaded SWF files using As3

What I'm trying to do is make some sort of a list that I can load SWF files to, so it will display them (not only the name of the SWF, but the SWF file itself)

I can create a bunch of URLLoaders but I think there should be an easier way to accomplish something like this ;)

Thanks and have a nice day.

Extract "Red" "Blue" "Circle" "Black" from "RedBlueCircleBlack" using capital as delimiter?

Is this a RegEx problem?

To note: there will always be only four items, each starts with a capital letter, each will be in order (color,color,shape,color): "BlackWhiteTriangleGreen" etc.

So,

    a="BlackWhiteTriangleGreen"  

yields:

    c1 = "Black"  
    c2 = "White"  
    S = "Triangle"  
    c3 = "Green"

Importing my original package

I am trying to import my original package. But it is said that there is no class files form Akirasda1972_001.as. My package file is uploaded on http://ift.tt/2cFnl54.

package{

import flash.display.Sprite;

import club.sexydesign.particle.Akirasada1972_001;

public class akirasada1972_002 extends Sprite{

    private var akirasada1972_001:Akirasada1972_001;

    public function akirasada1972_002():void{
        akirasada1972_001=new Akirasada1972_001();
        akirasada1972_001.Akirasada1972_001();
        addChild(akirasada1972_001);
    }

}

}

mercredi 21 septembre 2016

Flex - How to do calculation in Flash Builder

<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ift.tt/rYUnH9" 
    xmlns:s="library://ns.adobe.com/flex/spark" title="BMI Calculator">

<fx:Script>
    <![CDATA[
        protected function calculate_clickHandler(event:MouseEvent):void
        {
            // TODO Auto-generated method stub

        }
    ]]>
</fx:Script>

<fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:actionContent>
    <s:Button label="Back" click="navigator.pushView(MainHomeView)" styleName="back"/>
</s:actionContent>
<s:Label x="33" y="61" fontSize="30" text="Weight(kg) :"/>
<s:Label x="34" y="140" fontSize="30" text="Height(cm) :"/>
<s:TextInput id="mywieght" x="216" y="40" width="228" prompt="0.0kg" textAlign="right"/>
<s:TextInput id="myheight" x="216" y="119" width="228" prompt="0.0cm" textAlign="right"/>
<s:Button id="calculation" x="31" y="260" width="413" label="Calculate" fontSize="36"
          fontStyle="italic"/>
<s:Label id="myresult" left="31" right="36" height="146" fontSize="72" fontStyle="normal"
         fontWeight="bold" text="0.0" textAlign="center" verticalAlign="middle"
         verticalCenter="99"/>
</s:View>

this is the gui for a BMI calculator. i dont really have the basic of using flash builder. can anyone teach me how to use the data input by user inside the textinput and then use it for calculation and display it? thanks

Any way to Call A Function As A String?

I've just started a project, and am wondering if you can call a function (in an event listener) through a string.

import flash.utils.Timer;
import flash.events.Event;
import flash.events.TimerEvent;

var threesec:Timer=new Timer(3000, 1);
var whaton:String="tsecc"
threesec.start();
threesec.addEventListener(TimerEvent.TIMER_COMPLETE, whaton);
function tsecc(tsecc:TimerEvent):void{
    trace("Hello")
    threesec.reset();
    threesec.start();
}

This does not work because of this line:

threesec.addEventListener(TimerEvent.TIMER_COMPLETE, whaton);

and this error code:

1067: Implicit coercion of a value of type String to an unrelated type Function.

I know what I am doing is horribly wrong, but is there a correct way to call a function in string format?

Do I have to add a property to the variable, do I have to create another type of variable?

Switching frames in a MC in If Statements with AS3

Im trying to switch frames in an if statement, when "picking up" items.

Basically I have 3 maps, and with each map picked up, the frame should advance to the next frame. After I pick up one map it DOES advance to the next frame. The problem is when i go to pick up a second map it DOES NOT advance the frame.

Here is my code:

stage.addEventListener(Event.ENTER_FRAME, growVisible);

function growVisible(grow: Event) {
if (map1.hitTestPoint(character.x,character.y, true)) {
    darkness.gotoAndStop(currentFrame + 1);
    map1.visible = false;
}
if (map2.hitTestPoint(character.x, character.y, true)) {
    darkness.gotoAndStop(currentFrame + 1);
    map2.visible = false;
}
if (map3.hitTestPoint(character.x, character.y, true)) {
    darkness.gotoAndStop(currentFrame + 1);
    map3.visible = false;
}
}

"darkness" is the item im trying to advance a frame. map1, map2, map3, are the items that im picking up to do so.

Ive also tried the code like this with no luck:

function growVisible(grow: Event) {
if (map1.hitTestPoint(character.x,character.y, true)) {
    darkness.gotoAndStop(2);
    map1.visible = false;
    if (darkness.currentFrame == 2) {
        darkness.gotoAndStop(3);
    } else if (darkness.currentFrame == 3) {
        darkness.gotoAndStop(4);
    }
} if (map2.hitTestPoint(character.x, character.y, true)) {
    darkness.gotoAndStop(2);
    map2.visible = false;
    if (darkness.currentFrame == 2) {
        darkness.gotoAndStop(3);
    } else if (darkness.currentFrame == 3) {
        darkness.gotoAndStop(4);
    }
} if (map3.hitTestPoint(character.x, character.y, true)) {
    darkness.gotoAndStop(2);
    map3.visible = false;
    if (darkness.currentFrame == 2) {
        darkness.gotoAndStop(3);
    } else if (darkness.currentFrame == 3) {
        darkness.gotoAndStop(4);
    }
}
}

Any help would be greatly appreciated.

AS3 - 1st character resets (replaces) when i add another character

Well i am totally newbie to AS3, and i am learning it on my own.. but since this problem occurred, i can't help myself anymore

the thing is simple, when i run this code, if i place my first character, it gets placed wherever i want (based upon mouseX, mouseY) but when i place the second character (ConnecterMain.as) it resets the place of First Character, anyone better solution :/ and i wanted a block/area with menu of those Characters, but i find this alternative since i couldn't create a block/area like that (assuming all other classes are only body of the character, nothing more)

code

 package
{
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.geom.Point;

    public class Main extends Sprite 
    {
        public var powers:PowerStation = new PowerStation();
        public var powers1:PowerStationMain = new PowerStationMain;
        public var powers2:PowerStationPrototype = new PowerStationPrototype();
        public var con:Connecter = new Connecter;
        public var con1:ConnecterMain = new ConnecterMain;
        public var con2:ConnecterPrototype = new ConnecterPrototype;
        public var sp:Boolean = false;
        public var spc:Boolean = false;

        public function Main() 
        {   
            powers.x = 50;
            powers.y = 550;
            addChild(powers);

            con.x = 120;
            con.y = 560;
            addChild(con);

            stage.addEventListener(Event.ENTER_FRAME, update);
        }

        public function update(e:Event):void
        {
            var mousePoint:Point = new Point(mouseX, mouseY);
            if (mousePoint.x < powers.x + (powers.width - 1) && mousePoint.x > powers.x + 1)
            {
                if (mousePoint.y < powers.y + (powers.height - 1) && mousePoint.y > powers.y + 1)
                {
                    addEventListener(MouseEvent.CLICK, selected);
                }   
            }
            if (mousePoint.x < con.x + (con.width) && mousePoint.x > con.x - con.width)
            {
                if (mousePoint.y < con.y + (con.height / 2) && mousePoint.y >  con.y - (con.height / 2))
                {
                    addEventListener(MouseEvent.CLICK, selectedCon);
                }
            }
            function selected(e:MouseEvent):void
            {
                powers2.x = mousePoint.x;
                powers2.y = mousePoint.y;
                addChild(powers2);
                powers2.startDrag();
                sp = true;
                removeEventListener(MouseEvent.CLICK, selected);
            }
            if (sp === true)
            {
                stage.addEventListener(MouseEvent.MOUSE_DOWN, place);
            }
            function place(e:MouseEvent):void
            {
                powers1.x = powers2.x;
                powers1.y = powers2.y;
                powers2.stopDrag();
                addChild(powers1);
                stage.removeEventListener(MouseEvent.MOUSE_DOWN, place);
            }
            function selectedCon (e:MouseEvent):void
            {
                con2.x = mousePoint.x;
                con2.y = mousePoint.y;
                addChild(con2);
                con2.startDrag();
                spc = true;
                removeEventListener(MouseEvent.MOUSE_DOWN, selectedCon);
            }
            if (spc === true)
            {
                stage.addEventListener(MouseEvent.MOUSE_DOWN, placedCon);
            }
            function placedCon(e:MouseEvent):void
            {
                stage.removeEventListener(MouseEvent.MOUSE_DOWN, placedCon);
                con1.x = con2.x;
                con1.y = con2.y;
                con2.stopDrag();
                addChild(con1);
            }
        }
    }
}

Detect large of damage money

I have app request from banking. i want to make app who can detect damage of money. The output is, if 30% of lost of money object, can cange on the bank.

I have idea, we make capture with camera of money and the damage baground is white so, in as3 can count how percent of white color. if less then 30% so is good to cange on the Bank.

How to make code AS3 to make it solution.

Thanks for all.enter image description here

Decompiling flash to view its internal variables for sound played, so I need to view audio levels and pass variables back into player

I was looking at this website and it seems to be headed in the same direction I am headed but they are just trying to control volume

Example: http://ift.tt/2cT6RX5

Inside the given swf which that site gives the source to, they list this as code:

import flash.events.MouseEvent; 
import flash.media.SoundMixer;
import flash.media.SoundTransform;
import flash.events.Even;
import flash.utils.setInterval;
import flash.external.ExternalInterface;
var volumeCount:Number;
setInterval(function () {
volumeCount =       
ExternalInterface.call('GetPlayer().GetVar','volumeCount');
SoundMixer.soundTransform = new   
SoundTransform(volumeCount, 0);
}, 10);    

-volumeCount being the var that is created in the program "Storyline."

By looking at that could you add to this code or alter it to export the levels to a byte array then pass that # into volumecount? Which I will use in the Storyline program? If this can be done you are a miracle worker and I sincerely appreciate your help. Thank you! Reply or DM me with the altered code if you can solve it, while I continue trying.

Flash Database Operation Failed

I have a problem with my Flash (.fla) project. I've connected my flash with database with php script. I used ActionScript 2.0.

The problem is data can show at compile program on AdobeFlash CS6 (CTRL+Enter) but data cant show in datagrid when I open the .swf.

It's my php script

<?php

mysql_pconnect ("localhost", "root", "");
mysql_select_db ("modul");


   $qr = mysql_query("SELECT * from nilaisiswa");
   if (!qr || mysql_num_rows($qr)==0) {
      $r_string = '&errorcode=3&msg='.mysql_error().'&';
   } else {
      $r_string = '&errorcode=0&n='.mysql_num_rows ($qr);
      $i = 0;
      while ($row = mysql_fetch_assoc ($qr)) {
         while (list ($key, $val) = each ($row)) {
            $r_string .= '&' . $key . $i . '=' . stripslashes($val);
         }
         $i++;
      }

      $r_string .='&';
   }

echo $r_string;
?>

And here it's my ActionScript 2.0

var select_lv:LoadVars = new LoadVars();
var insert_lv:LoadVars = new LoadVars();
var delete_lv:LoadVars = new LoadVars();
var today:Date = new Date();
var deleteIndex:Number;

var errorMsgs:Array = [
    "",     
    "Couldn't connect to server",
    "Couldn't connect to database",
    "Error running query",
    "First four entries may not be deleted"];

var filepath:String;

var scoreInfo:Array = [];

var headerListener:Object = {};
headerListener.headerRelease = function(event:Object) {
    switch (event.columnIndex) {
        case 0:
            if (scores_dg.getColumnAt(0).sortedUp) {
                scores_dg.sortItemsBy(scores_dg.columnNames[0], Array.CASEINSENSITIVE | Array.DESCENDING);
            } else {
                scores_dg.sortItemsBy(scores_dg.columnNames[0], Array.CASEINSENSITIVE);
            }
            scores_dg.getColumnAt(0).sortedUp = !scores_dg.getColumnAt(0).sortedUp;
            break;
        case 1:
            if (scores_dg.getColumnAt(1).sortedUp) {
                scores_dg.sortItemsBy(scores_dg.columnNames[1], Array.NUMERIC | Array.DESCENDING);
            } else {
                scores_dg.sortItemsBy(scores_dg.columnNames[1], Array.NUMERIC);
            }
            scores_dg.getColumnAt(1).sortedUp = !scores_dg.getColumnAt(1).sortedUp;
            break;
    }
}

function zerofill(n:Number):String {
    if (n<10) return '0' + n.toString();
    else return n.toString();
}

filepath = "http://localhost/tesis/";

nickname_ti.maxChars = 50;
date_ti.maxChars = 10;
score_ti.text = 0;
date_ti.text = today.getDate() + '-' + zerofill(today.getMonth()+1) + '-' + zerofill(today.getFullYear());


select_lv.onLoad = function(ok:Boolean) {
    if (ok) {
        if (this.errorcode=="0") {
            for (var i:Number=0; i < this.n; i++) {
                scoreInfo.push(
                    {record:this["id"+i],
                     nickname:this["nickname"+i],
                     score:Number(this["score"+i]),
                     dateposted:this["dateposted"+i]
                    });
            }
            scores_dg.columnNames = ["nickname", "score", "dateposted"];
            scores_dg.getColumnAt(0).width = 130;
            scores_dg.getColumnAt(0).sortOnHeaderRelease = false;
            scores_dg.getColumnAt(0).sortedUp = false;
            scores_dg.getColumnAt(0).headerText = "Nickname";
            scores_dg.getColumnAt(1).width = 130;
            scores_dg.getColumnAt(1).sortOnHeaderRelease = false;
            scores_dg.getColumnAt(1).sortedUp = false;
            scores_dg.getColumnAt(1).headerText = "Score";
            scores_dg.getColumnAt(2).width = 130;
            scores_dg.getColumnAt(2).headerText = "Date Posted";
            scores_dg.dataProvider = scoreInfo;
            scores_dg.addEventListener("headerRelease", headerListener);
            msg_ta.text = "Enter data and click Add to add a score.";
        } else {
            msg_ta.text = errorMsgs[Number(this.errorcode)];
            if (this.errorcode == "3") msg_ta.text += ": " + this.msg;
        }
    } else {
        msg_ta.text = "Flash-database select operation failed";
    }
}
msg_ta.text = "Getting high scores from database...";
select_lv.sendAndLoad(filepath + "getscores.php", select_lv, "GET");

mardi 20 septembre 2016

Input text changes an integer? AS3

I am making a small AS3 function of the Collatz conjecture. This is the code:

import flash.events.Event;
import flash.events.MouseEvent;

var numb:int=0
var amount:int=0
button.addEventListener(MouseEvent.CLICK, buttonclick)
function buttonclick(buttonclicked:MouseEvent):void{
    numb=int(input.text)
    trace(numb)
    amount=0
}
stage.addEventListener(Event.ENTER_FRAME, equate)
function equate(equate:Event):void{
    dynam.text=amount.toString() + "\n" + numb.toString();;
    if(numb !=0 && numb !=1){
        if(numb % 2 == 0){
            numb=numb/2
            amount+=1
        }
        else{
            numb=numb*3+1
            amount+=1
        }
    }
}

However, sometimes the textinput becomes a negative number.

123123123123 turns into -1430928461

12312312312321312 turns into -1715645152

And so on.

I do not know why, but I think it has to do with

numb=int(input.text)

But I do not want to do absolute value, because then the equation would make the wrong results. If you want it to stop on the negative number (and test it yourself) do this:

if(numb !=0 && numb !=1 && numb>1)

Instead of

if(numb !=0 && numb !=1)

Using ffmpeg with AIR

Does anyone have experience using ffmpeg with AIR? I have been able to load and play a video but I have not been able to communicate with ffmpeg through stdin in order to control the stream – to seek, pause, etc.

Apparently I need to use filters to communicate with a running instance of ffmpeg but I am struggling with the syntax (or else am misinformed 🙄 ).

Based on a few things gleaned from the web I am trying this but it doesn't do anything:

var cmd:String = "-f lavfi -i movie=filename='" + videoPath + "':streams=0+1[out0][out1]  -c:a copy -c:v copy -f flv -"

ffmpegProcess.standardInput.writeUTF(cmd + "\n");


Any tips would be most welcome!


Loading code (set up of the NetStream, etc. done elsewhere). This works.

ffmpegArgs = new Vector.<String>();
ffmpegArgs.push("-re", "-i",videoPath,"-c:a", "copy", "-c:v", "copy","-f", "flv", "-");

var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
nativeProcessStartupInfo.executable = ffmpegFile;
nativeProcessStartupInfo.arguments = ffmpegArgs;
ffmpegProcess.start(nativeProcessStartupInfo);

Flex converting numeric string to exponential form

This is a weird issue I came across or a Flex 3 shortcoming. I am using SOAP messaging protocol and the response from the server for filling the 'Notes' field which I have on a pop-up looks like this:

Fiddler response - GLNotes

Since this is SOAP I am getting the response as a XML string. The GLNotes field value is 4582e12.

Some Flex code on how I handle this response:

<mx:DataGrid dataProvider="{AccruedIncomeWS.GetAccruedIncomeList.lastResult.root.AccruedIncomeList.Item}" 
itemClick="AccrualClick(event);" id="AccrualList>
    <mx:columns>
        ...
    </mx:columns>
</mx:DataGrid>

Now I created a watch expression for AccrualList.selectedItem and I see:

SelectedItem numeric data

Why is the GLNotes getting converted to a Number here? To test out this implicit conversion I put some characters in the notes field and got this in the watch expression:

SelectedItem string data

With the presence of some alphabets the GLNotes field is treated as a string. Is there anyway I can make this value strongly typed and not have any implicit conversions applied? Let me know if additional info is required. Thanks!

AS3: Finding coordinates of a string array

I'm learning AS3 and I'm programming a typewriter effect with a blinking cursor. Now I'm "cheating" moving the blinking cursor. Is there a way to locate coordinates of the string when they are shown on the screen?

var myString:String = "Lore Ipsum";
var myArray:Array = myString.split("");

stage.addEventListener(KeyboardEvent.KEY_DOWN, myKeyDown);

function myKeyDown(e:KeyboardEvent):void{
    tf.appendText(myArray.shift());
    BlinkingCursor.x = BlinkingCursor.x + 5;
}

Compiling actionscript from a text file using mxmlc

I need to compile the following source code into a swf:

package com.senocular.utils {

    import flash.display.ActionScriptVersion;
    import flash.errors.EOFError;
    import flash.geom.*;
    import flash.utils.ByteArray;
    import flash.utils.Endian;

    /**
     * Reads the bytes of a SWF (as a ByteArray) to acquire 
     * information from the SWF file header.  Some of
     * this information is inaccessible to ActionScript
     * otherwise.
     */
    public class SWFReader {

        // properties starting with those
        // found first in the byte stream

        /**
         * Indicates whether or not the SWF
         * is compressed.
         */
        public var compressed:Boolean;

        /**
         * The major version of the SWF.
         */
        public var version:uint;

        /**
         * The file size of the SWF.
         */
        public var fileSize:uint;

        // compression starts here if SWF compressed:

        /**
         * The dimensions of the SWF in the form of
         * a Rectangle instance. 
         */
        public function get dimensions():Rectangle { return _dimensions; }
        private var _dimensions:Rectangle = new Rectangle();
        // dimensions gets accessor since we don't
        // want people nulling the rect; it should
        // always have a value, even if 0-ed

        /**
         * Width of the stage as defined by the SWF.
         * Same as dimensions.width.
         */
        public function get width():uint {
            return uint(_dimensions.width);
        }

        /**
         * Height of the stage as defined by the SWF.
         * Same as dimensions.height.
         */
        public function get height():uint {
            return uint(_dimensions.height);
        }

        /**
         * When true, the bytes supplied in calls made to the tagCallback
         * function includes the RECORDHEADER of that tag which includes
         * the tag and the size of the tag. By default (false) this
         * information is not included.
         */
        public function get tagCallbackBytesIncludesHeader():Boolean {
            return _tagCallbackBytesIncludesHeader;
        }
        public function set tagCallbackBytesIncludesHeader(value:Boolean):void {
            _tagCallbackBytesIncludesHeader = value;
        }
        private var _tagCallbackBytesIncludesHeader:Boolean = false;

        /**
         * The frame rate of the SWF in frames
         * per second.
         */
        public var frameRate:uint;

        /**
         * The total number of frames of the SWF.
         */
        public var totalFrames:uint;

        /**
         * ActionScript version.
         */
        public var asVersion:uint;

        /**
         * Determines local playback security; when
         * true, indicates that when this file is
         * run locally, it can only access the network.
         * When false, only local files can be accessed.
         * This does not apply when the SWF is being
         * run in a local-trusted sandbox.
         */
        public var usesNetwork:Boolean;

        /**
         * The background color of the SWF.
         */
        public var backgroundColor:uint;

        /**
         * Determines if the SWF is protected from
         * being imported into an authoring tool.
         */
        public var protectedFromImport:Boolean;

        /**
         * Determines if remote debugging is enabled.
         */
        public var debuggerEnabled:Boolean;

        /**
         * The XMP metadata defined in the SWF.
         */
        public var metadata:XML;

        /**
         * Maximun allowed levels of recursion.
         */
        public var recursionLimit:uint;

        /**
         * Time in seconds a script will run in a
         * single frame before a timeout error
         * occurs.
         */
        public var scriptTimeoutLimit:uint;

        /**
         * The level of hardware acceleration specified
         * for the SWF. 0 is none, 1 is direct, and 2
         * is GPU (Flash Player 10+).
         */
        public var hardwareAcceleration:uint;

        /**
         * A callback function that will be called when
         * a tag is read during the parse process. The
         * callback function should contain the parameters
         * (tag:uint, bytes:ByteArray).
         */
        public var tagCallback:Function;

        /**
         * Indicates that the SWF bytes last provided
         * were successfully parsed. If the SWF bytes
         * were not successfully parsed, no SWF data
         * will be available.
         */
        public var parsed:Boolean;

        /**
         * The Flash Player error message that resulted
         * from the error that caused a parse to fail.
         */
        public var errorText:String = "";

        // keeping track of data
        private var bytes:ByteArray;
        private var currentByte:int; // used in bit reading
        private var bitPosition:int; // used in bit reading
        private var currentTag:uint;

        // tag flags
        private var bgColorFound:Boolean;

        // constants
        private const GET_DATA_SIZE:int         = 5;
        private const TWIPS_TO_PIXELS:Number    = 0.05; // 20 twips in a pixel
        private const TAG_HEADER_ID_BITS:int    = 6;
        private const TAG_HEADER_MAX_SHORT:int  = 0x3F;

        private const SWF_C:uint                = 0x43; // header characters
        private const SWF_F:uint                = 0x46;
        private const SWF_W:uint                = 0x57;
        private const SWF_S:uint                = 0x53;

        private const TAG_ID_EOF:uint           = 0; // recognized SWF tags
        private const TAG_ID_BG_COLOR:uint      = 9;
        private const TAG_ID_PROTECTED:uint     = 24;
        private const TAG_ID_DEBUGGER1:uint     = 58;
        private const TAG_ID_DEBUGGER2:uint     = 64;
        private const TAG_ID_SCRIPT_LIMITS:uint = 65;
        private const TAG_ID_FILE_ATTS:uint     = 69;
        private const TAG_ID_META:uint          = 77;

        private const TAG_ID_SHAPE_1:uint       = 2;
        private const TAG_ID_SHAPE_2:uint       = 22;
        private const TAG_ID_SHAPE_3:uint       = 32;
        private const TAG_ID_SHAPE_4:uint       = 83;

        /**
         * SWFHeader constructor.
         * @param   swfBytes Bytes of the SWF in a ByteArray.
         * You can get the bytes of a SWF by loading it into
         * a URLLoader or using Loader.bytes once a SWF has
         * been loaded into that Loader.
         */
        public function SWFReader(swfBytes:ByteArray = null) {
            parse(swfBytes);
        }

        /**
         * Provides a string presentation of the SWFHeader
         * object which outlines the different values
         * obtained from a parsed SWF
         * @return The String form of the instance
         */
        public function toString():String {
            if (parsed) {
                var compression:String  = (compressed) ? "compressed" : "uncompressed";
                var frames:String       = totalFrames > 1 ? "frames" : "frame";
                return "[SWF" + version + " AS"+asVersion+".0: " + totalFrames + " "+frames+" @ " + frameRate + " fps "
                    + _dimensions.width + "x" + _dimensions.height + " " + compression + "]";
            }

            // default toString if SWF not parsed
            return Object.prototype.toString.call(this);
        }

        /**
         * Parses the bytes of a SWF file to extract
         * properties from its header.
         * @param   swfBytes Bytes of a SWF to parse.
         */
        public function parse(swfBytes:ByteArray):void {
            parseDefaults();

            // null bytes, exit
            if (swfBytes == null) {
                parseError("Error: Cannot parse a null value.");
                return;
            }


            // assume at start parse completed successfully
            // on failure, this will be set to false
            parsed = true;

            // --------------------------------------
            // HEADER
            // --------------------------------------

            try {

                // try to parse the bytes.  Failures
                // results in cleared values for the data
                bytes           = swfBytes;
                bytes.endian    = Endian.LITTLE_ENDIAN;
                bytes.position  = 0;

                // get header characters
                var swfFC:uint  = bytes.readUnsignedByte(); // F, or C if compressed
                var swfW:uint   = bytes.readUnsignedByte(); // W
                var swfS:uint   = bytes.readUnsignedByte(); // S

                // validate header characters
                if ((swfFC != SWF_F && swfFC != SWF_C)
                ||   swfW  != SWF_W || swfS  != SWF_S) {
                    parseError("Error: Invalid SWF header.");
                    return;
                }

                compressed  = Boolean(swfFC == SWF_C); // == SWF_F if not compressed

                version     = bytes.readUnsignedByte();

                fileSize    = bytes.readUnsignedInt(); // mostly redundant since we should have full bytes

                // if compressed, need to uncompress
                // the data after the first 8 bytes
                // (first 8 already read above)
                if (compressed) {

                    // use a temporary byte array to
                    // represent the compressed portion
                    // of the SWF file 
                    var temp:ByteArray = new ByteArray();
                    bytes.readBytes(temp);
                    bytes           = temp;
                    bytes.endian    = Endian.LITTLE_ENDIAN;
                    bytes.position  = 0;
                    temp            = null; // temp no longer needed

                    bytes.uncompress();

                    // Note: at this point, the original
                    // uncompressed 8 bytes are no longer
                    // part of the current bytes byte array
                }

                _dimensions = readRect();
                bytes.position++; // one up after rect

                frameRate   = bytes.readUnsignedByte();

                totalFrames = bytes.readUnsignedShort();

            }catch (error:Error) {

                // header parse error
                parseError(error.message);
                return;
            }

            // --------------------------------------
            // TAGS
            // --------------------------------------

            // read all the tags in the file
            // up until the END tag
            try {
                while(readTag());
            }catch (error:Error) {

                // error in tag parsing. EOF would throw
                // an error, but the END tag should be
                // reached before that occurs
                parseError(error.message);
                return;
            }

            // parse completed successfully!
            // null bytes since no longer needed
            bytes = null;
        }

        /**
         * Defines default values for all the class
         * properties.  This is used to have accurate
         * values for properties which may not be 
         * present in the SWF file such as asVersion
         * which is only required to be specified in
         * SWF8 and above (in FileAttributes tag).
         */
        private function parseDefaults():void {
            compressed      = false;
            version         = 1; // SWF1
            fileSize        = 0;
            _dimensions     = new Rectangle();
            frameRate       = 12; // default from Flash authoring (flex == 24)
            totalFrames     = 1;
            metadata        = null;
            asVersion       = ActionScriptVersion.ACTIONSCRIPT2; // 2 if not explicit
            usesNetwork     = false;
            backgroundColor = 0xFFFFFF; // white background
            protectedFromImport = false;
            debuggerEnabled = true;
            scriptTimeoutLimit  = 256;
            recursionLimit  = 15;
            hardwareAcceleration    = 0;

            errorText       = ""; // clear existing error text

            // tag helper flags
            bgColorFound    = false;
        }

        /**
         * Clears variable data and logs an error
         * message.
         */
        private function parseError(message:String = "Unkown error."):void {
            compressed      = false;
            version         = 0;
            fileSize        = 0;
            _dimensions     = new Rectangle();
            frameRate       = 0;
            totalFrames     = 0;
            metadata        = null;
            asVersion       = 0;
            usesNetwork     = false;
            backgroundColor = 0;
            protectedFromImport = false;
            debuggerEnabled = false;
            scriptTimeoutLimit  = 0;
            recursionLimit  = 0;
            hardwareAcceleration    = 0;

            parsed          = false;
            bytes           = null;
            errorText       = message;
        }

        /**
         * Utility to convert a unit value into a string
         * in hex style padding value with "0" characters.
         * @return The string representation of the hex value.
         */
        private function paddedHex(value:uint, numChars:int = 6):String {
            var str:String = value.toString(16);
            while (str.length < numChars) str = "0" + str;
            return "0x" + str;
        }

        /**
         * Reads a string in the byte stream by
         * reading all bytes until a null byte (0)
         * is reached.
         * @return The string having been read.
         */
        private function readString():String {

            // find ending null character that
            // terminates the string
            var i:uint = bytes.position;
            try {
                while(bytes[i] != 0) i++;
            }catch (error:Error) {
                return "";
            }

            // null byte should have been found
            // return the read string
            return bytes.readUTFBytes(i - bytes.position);
        }

        /**
         * Reads RECT data from the current
         * location in the current bytes object
         * @return A rectangle object whose values
         * match those of the RECT read.
         */
        private function readRect():Rectangle {
            nextBitByte();
            var rect:Rectangle  = new Rectangle();
            var dataSize:uint   = readBits(GET_DATA_SIZE);
            rect.left           = readBits(dataSize, true)*TWIPS_TO_PIXELS;
            rect.right          = readBits(dataSize, true)*TWIPS_TO_PIXELS;
            rect.top            = readBits(dataSize, true)*TWIPS_TO_PIXELS;
            rect.bottom         = readBits(dataSize, true)*TWIPS_TO_PIXELS;
            return rect;
        }

        private function readMatrix():Matrix {
            nextBitByte();
            var dataSize:uint;
            var matrix:Matrix = new Matrix();

            if (readBits(1)){ // has scale
                dataSize    = readBits(GET_DATA_SIZE);
                matrix.a    = readBits(dataSize, true);
                matrix.d    = readBits(dataSize, true);
            }

            if (readBits(1)){ // has rotation
                dataSize    = readBits(GET_DATA_SIZE);
                matrix.b    = readBits(dataSize, true);
                matrix.c    = readBits(dataSize, true);
            }

            // translation
            dataSize    = readBits(GET_DATA_SIZE);
            matrix.tx   = readBits(dataSize, true)*TWIPS_TO_PIXELS;
            matrix.ty   = readBits(dataSize, true)*TWIPS_TO_PIXELS;

            return matrix;
        }

        /**
         * Reads a series of bits from the current byte
         * defined by currentByte based on the but at
         * position bitPosition.  If more bits are required
         * than are available in the current byte, the next
         * byte in the bytes array is read and the bits are
         * taken from there to complete the request.
         * @param   numBits The number of bits to read.
         * @return The bits read as a uint.
         */
        private function readBits(numBits:uint, signed:Boolean = false):Number {
            var value:Number    = 0; // int or uint
            var remaining:uint  = 8 - bitPosition;
            var mask:uint;

            // can get all bits from current byte
            if (numBits <= remaining){
                mask    = (1 << numBits) - 1;
                value   = (currentByte >> (remaining - numBits)) & mask;
                if (numBits == remaining) nextBitByte();
                else bitPosition += numBits;

            // have to get bits from 2 (or more)
            // bytes the current and the next (recursive)
            }else{
                mask                = (1 << remaining) - 1;
                var firstValue:uint = currentByte & mask;
                var over:uint       = numBits - remaining;
                nextBitByte();
                value = (firstValue << over) | readBits(over);
            }

            // convert to signed int if signed bitflag exists
            if (signed && value >> (numBits - 1) == 1){
                remaining = 32 - numBits; // 32-bit uint
                mask = (1 << remaining) - 1;
                return int(mask << numBits | value);
            }

            // unsigned int
            return uint(value); 
        }

        /**
         * Reads the next byte in the stream assigning
         * it to currentByte and resets the value of
         * bitPosition to 0.
         */
        private function nextBitByte():void {
            currentByte = bytes.readByte();
            bitPosition = 0;
        }

        /**
         * Parses the tag at the current byte location.
         * @return false if the tag read is the END tag;
         * true if more tags should be present in the file.
         */
        private function readTag():Boolean {

            var currentTagPosition:uint = bytes.position;

            // read tag header
            var tagHeader:int = bytes.readUnsignedShort();
            currentTag = tagHeader >> TAG_HEADER_ID_BITS;
            var tagLength:uint = tagHeader & TAG_HEADER_MAX_SHORT;

            // if a long tag, the tag length will be
            // set to its maximum. If so, set
            // the tag length to the long length
            if (tagLength == TAG_HEADER_MAX_SHORT) {
                tagLength = bytes.readUnsignedInt();
            }

            // when the tag is read, the position
            // of the byte stream must be set to the
            // end of this tag for the start of the next
            // tag.  This assures the correct position
            // no matter what happens in readTagData()
            var nextTagPosition:uint = bytes.position + tagLength;

            // read the data in the tag (if supported)
            var moreTags:Boolean = readTagData(tagLength, currentTagPosition, nextTagPosition);
            if (!moreTags) return false; // end tag

            // next tag
            bytes.position = nextTagPosition;
            return true;
        }

        /**
         * Called from readTag, this parses the value of individual
         * tag based on the tag id read in the tag header.
         * @param   tag A tag object containing a tag's id and length.
         * @param   start The start position of the full tag.
         * @param   end The end position of the full tag.
         * @return false if the tag read is the END tag;
         * true if more tags should be present in the file.
         */
        private function readTagData(tagLength:uint, start:uint, end:uint):Boolean {

            // if defined, call the tag callback with
            // the tag id and a copy of the bytes 
            // specific to the tag
            if (tagCallback != null) {
                var tagBytes:ByteArray = new ByteArray();
                if (_tagCallbackBytesIncludesHeader){
                    tagBytes.writeBytes(bytes, start, end - start);
                }else{
                    if (tagLength){
                        tagBytes.writeBytes(bytes, bytes.position, tagLength);
                    }
                }
                tagBytes.position = 0;
                tagCallback(currentTag, tagBytes);
            }

            // handle each tag individually based on
            // it's tag id
            switch (currentTag) {


                // FileAttributes tag was only required for
                // SWF 8 and later. Calling defaults()
                // assures default values for the properties
                // determined here if the tag is not present
                case TAG_ID_FILE_ATTS:

                    nextBitByte(); // read file attributes in bits
                    readBits(1); // reserved

                    hardwareAcceleration = readBits(2);

                    readBits(1); // hasMetaData; auto-determined by tag

                    asVersion = (readBits(1) && version >= 9)
                        ? ActionScriptVersion.ACTIONSCRIPT3
                        : ActionScriptVersion.ACTIONSCRIPT2;

                    readBits(2); // reserved (2)

                    usesNetwork = Boolean(readBits(1) == 1);
                    // bunch of others reserved after this
                    break;


                // Metadata in a SWF is in the format of
                // XMP XML. Though the FileAttributes will
                // determine if it is present, it's easier to
                // just check for the metadata tag id
                case TAG_ID_META:

                    try {
                        metadata = new XML(readString());
                    }catch (error:Error) {
                        // error reading string or parsing as XML
                    }
                    break;


                // Many background colors could potentially exist
                // for a single SWF, but we're assuming there's
                // only one. If there are more, the first will be used
                case TAG_ID_BG_COLOR:

                    // check the bg color found flag
                    // if true, we want to ignore all other colors
                    // since they would be added after this one
                    if (!bgColorFound) {
                        bgColorFound = true;

                        backgroundColor = readRGB();
                    }
                    break;


                // Only determines if the SWF is protected from 
                // import; a password, if provided, will not
                // be retrieved from the SWF
                case TAG_ID_PROTECTED:

                    protectedFromImport = Boolean(bytes.readUnsignedByte() != 0);
                    // password if needed
                    break;


                // the debugger 1 tag is for SWF5 only
                // the debugger 2 tag is for SWF6+
                case TAG_ID_DEBUGGER1:

                    if (version == 5) debuggerEnabled = true;
                    // password if needed
                    break;
                case TAG_ID_DEBUGGER2:

                    if (version > 5) debuggerEnabled = true;
                    // password if needed
                    break;

                // for both timeout and recursion but I don't
                // think any tool lets you set recursion
                case TAG_ID_SCRIPT_LIMITS:
                    recursionLimit      = bytes.readUnsignedShort();
                    scriptTimeoutLimit  = bytes.readUnsignedShort();
                    break;

                case TAG_ID_EOF:
                    return false; // end of file
                    break;

                default:
                    // unrecognized tag by this parser; do nothing
                    // if you want to support other tags
                    // make sure they're caught above in 
                    // this switch statement.
                    break;
            }

            // not last tag, continue reading
            return true;
        }
        private function readRGB():uint {
            return (bytes.readUnsignedByte() << 16) // R
                 | (bytes.readUnsignedByte() << 8)  // G
                 |  bytes.readUnsignedByte(); //       B
        }
        private function readARGB():uint {
            return (bytes.readUnsignedByte() << 24) // A
                 | (bytes.readUnsignedByte() << 16) // R
                 | (bytes.readUnsignedByte() << 8)  // G
                 |  bytes.readUnsignedByte(); //       B
        }
        private function readRGBA():uint {
            var rByte:uint = bytes.readUnsignedByte(); // R
            var gByte:uint = bytes.readUnsignedByte(); // G
            var bByte:uint = bytes.readUnsignedByte(); // B
            var aByte:uint = bytes.readUnsignedByte(); // A
            return (aByte << 24) // A
                 | (rByte << 16) // R
                 | (gByte << 8)  // G
                 |  bByte; //       B
        }
    }
}

Using the information found on this site, I installed the Adobe Flex SDK and made sure that I have the 32-bit version of the JDK installed on my system (and updated the path variable).

The aforementioned site says that I should save my source code as text and then give it a name like filename.as. So I did this, and the file was saved as filename.as.txt. So it was saved as a text file, just like the instructions said. However, when I went to the command prompt to compile the file using mxmlc filename.as.txt, I was told that I was using an "unsupported file type." So I tried just adding .as or .txt, and neither of these options worked. Is there some obvious error I am making?

Also, notepad will not allow me to change the file type to actionscript when saving. The only options are "all files" and "text".