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

When movieclip stops goto frame or next movie clip

$
0
0

On frame 1 i have a button that plays the next frame

stop();

playbtn.addEventListener(

MouseEvent.MOUSE_UP,

function(evt:MouseEvent):void {

trace("next frame");

nextFrame();

}

);

 

 

 

On frame 2 my movie clip currently has this as3.

 

// frame 1

var loops:int; // it will default to 0, but will not reassign it when returning

 

// frame to stop in... no need to avoid frame 1

loops = loops + 1;

if (loops == 5) {

          stop();

   

}

 

 

I have it loop then stop. I need to to go to the next frame in the flash or to another movieclip after it stops, but i don't know how and i haven't been able to find anything that makes it work. Please help? (as3, Cs4)


Get modification date on a file

$
0
0

Hi,

 

is it possible to get the last modification date on a file via flash?

 

I need to check last modified date, if this is modified then i need to load it. But i can't find out that. :/

Error #1056: Cannot create property 0 on String.

$
0
0

I found similar posts about this but was unable to find my situation.

 

I have 2 arrays, One is filled out earlier in the program by user inputs in the following format:

 

VideoArray[0] : nothing

VideoArray[1] : [Object]

VideoArray[1][0]: String (this string is inputed by the user in a text field)

VideoArray[1][1]: String (this string is inputed by the user in a text field)

 

It then follows the pattern of user inputs:

[2]:Object

[2][0]:string

[2][1]:string

[3]

[3][0]

[3][1]

... repeat for as long as the user inputs data.

 

I am trying to copy the data into another array using a series of loops since i wont know how many sets of data the user inputs. i dont need the object data in the new array. The new array (InfoArray) will be structured like so:

 

InfoArray[0]: String

InfoArray[1]: Number

InfoArray[2]: nothing

InfoArray[2][0]: VideoArray[1][0]

InfoArray[2][1]: VideoArray[1][1]

InfoArray[3][0]: VideoArray[2][0]

InfoArray[3][1]: VideoArray[2][1]

.. repeat untill all the data is copied.

 

 

 

 

I do this with the following:

 

 


ArrayCount = VideoArray.length + QuestionArray.length + 2



for(var i:int = 0; i<=ArrayCount; i++)



{




if (i == 0)




{





InfoArray[i]=ModuleName;




}else




{





if (i == 1)






{







InfoArray[i]=Number_Of_Videos;





}else






{







if(i <=Number_Of_Videos + 2)






{







InfoArray[i]=[];






for(var j:int = 0; j<=1; j++)






{







trace("i = "+i);







trace("j = "+j);







trace("VideoArray[i-1][j]: "+ VideoArray[i-1][j]);







InfoArray[i] = "Video: ";

Line 272




InfoArray[i][j] = VideoArray[i-1][j];






}





}else






{

(not sure why it copied the code like this, I couldnt find an "insert code" button)

 

When I run it I get my traces and the error:

i = 2

j = 0

VideoArray[i-1][j]: v1

ReferenceError: Error #1056: Cannot create property 0 on String.

          at BWSModuleGenerator_fla::MainTimeline/Compile_Info()[BWSModuleGenerator_fla.MainTimeline:: frame1:272]

 

Ive never gotten this error before, and im not sure whats wrong with my coding.

 

thanks for any help.

TempInit -- Expecting semicolon before disabled

$
0
0

Hi there,

 

I am trying to upgrade my flash programming from AS2 to AS3. There were lots of syntax issues which I am able to fix those but I have one issue remaining to fix and no idea what this is about. It looks like it is pointing to compiler issue.

 

this is the actual error:

tempInit, Line 1, Column 171086: Syntax error: expecting semicolon before disabled.

 

I do have this in my Line 1:

import flash.geom.ColorTransform;

 

I guess this tempInit is pointing to adobe compiler..

 

Could you please help me to fix this error?

 

Thank you very much.

incorrect number of arguments expected 1

$
0
0

Hi,

 

I'm new to this flex. Actually i want to set busycursor in loadValue Function. But i'm getting error as Here i'm getting an error as incorrect number of arguments expected 1.

the error that i'm getting in 3rd line. and i have not pasted full code here. But i pasted only where i'm getting error when i tried to inser busyCursor.

So please help me what i hv to change. waiting for your replay.

 

 

 

 

 

 

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

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"

          creationComplete="loadValues()" horizontalAlign="center"      --------------->  Here i'm getting an error as incorrect number of arguments expected 1.

          verticalAlign="middle"  color="#080808" borderColor="#FFF8E0" backgroundColor="#FFF8E0"

          xmlns:local="*"

          xmlns:tInput="assets.actionScript.*"

          xmlns:controls="com.iwobanas.controls.*"

          initialize="initTimer()"

          xmlns:dataGridClasses="com.iwobanas.controls.dataGridClasses.*"

          applicationComplete="init(event)" height="100%" width="100%">

 

<mx:Style source="defaults.css" />

 

 

<mx:Script>  

          <![CDATA[

                    import assets.actionScript.Trim;

                    import com.scottlogic.charts.DataGridExporter;

                    import mx.controls.ComboBase;

                    import assets.script.pods.view.Data;

                    import org.alivepdf.layout.Unit;

                    import mx.collections.ICollectionView;

                    import assets.actionScript.EscalationDTO;

                    import alarmSlide.TowerSelection;

 

                    import flash.net.navigateToURL;

                    import mx.binding.utils.BindingUtils;

                    import mx.controls.dataGridClasses.DataGridItemRenderer;

                    import mx.events.ListEvent;

                    import mx.charts.chartClasses.DualStyleObject;

                    import assets.actionScript.TowerInchargeRoleMappingDTO;

                    import flash.utils.clearInterval;

                    import flash.utils.setInterval;

                    import alarmSlide.SendMessageForEscalation;

                    import mx.skins.halo.BusyCursor;

                    import alarmSlide.REForAlarmReport;

 

                    import mx.managers.ToolTipManager;

                    import mx.controls.ToolTip;

                    import mx.collections.SortField;

                    import mx.collections.Sort;

                    import mx.messaging.messages.RemotingMessage;

                    import mx.events.AdvancedDataGridEvent;

                    import assets.actionScript.TowerStatus; 

                    import mx.rpc.events.FaultEvent;

                    import mx.rpc.events.ResultEvent;

                    import assets.actionScript.ValueObject;

                    import mx.messaging.channels.AMFChannel;

                    import alarmSlide.LEDChar;

                    import mx.utils.URLUtil;

                    import com.adobe.serialization.json.JSON;

                    import com.adobe.serialization.json.JSONDecoder; 

                    import mx.collections.ArrayCollection;

                    import mx.collections.IViewCursor;

                    import mx.collections.IHierarchicalCollectionView;

                    import mx.controls.Alert;

                    import mx.managers.PopUpManager; 

        import flash.net.FileReference;

               import mx.messaging.messages.IMessage;

              import mx.messaging.Channel;

              import mx.messaging.ChannelSet;

              import mx.messaging.channels.StreamingAMFChannel;

                    import flash.display.StageDisplayState;      

                    import mx.collections.ArrayCollection;

                    import mx.managers.CursorManager;

                                  

                    private var sendMessageScreen:SendMessageForEscalation;

                    private var escalationAlarmHistoryPopup:EscalationAlarmHistoryPopup;

                    public var manualOrScheduleTicketing:ManualOrScheduleTicketing;

                    public var editEscalationLevelPopup:EditEscalationLevelPopup;

                    private var escalationLevelPopup:EscalationLevelPopup;

                    private var escalationSiteDetailsPopup:EscalationSiteDetailsPopup;

 

                    [Bindable] private var towerName:String = "NoData";  

                    [Bindable] private var contactNumber:String = "NoData";

 

                    // Data Storgae variables

                    [Bindable] private var energyConsumption:ArrayCollection = new ArrayCollection();

                    [Bindable] public var dataColl:ArrayCollection = new ArrayCollection();

                    [Bindable] public var closedTicketArrayColl:ArrayCollection = new ArrayCollection();

                    [Bindable] private var towerDetails:ArrayCollection = new ArrayCollection();

                    [Bindable] private var escalationData:ArrayCollection = new ArrayCollection();

                    [Bindable] public var escalationLevelDetails:ArrayCollection = new ArrayCollection();

                    [Bindable] public var towerEscalationLevelDetails:ArrayCollection = new ArrayCollection();

                    [Bindable] private var escalationMasterList:ArrayCollection = new ArrayCollection();

                    [Bindable] public var alarmDetailsList:ArrayCollection = new ArrayCollection();

 

                    [Bindable] public var siteInformationList:ArrayCollection;

                    [Bindable] public var communicationInfoList:ArrayCollection;

                    [Bindable] public var operatorDetailsList:ArrayCollection;

                    [Bindable] public var siteLiveDataList:ArrayCollection;

                    [Bindable] public var siteLiveAlarmDetailsList:ArrayCollection;

                    [Bindable] public var ticketEscalationStateList:ArrayCollection = new ArrayCollection();

                    [Bindable]

                    public var siteAndDistrictDisplayName:String="";

                    public var categoriesArrColl:ArrayCollection = null;

                    public var tempArrColl:ArrayCollection = null;

                    public var userID:int = 0;

                    public var customertId:int = 3;

                    private var popupWin:PopupForTicketing;

                    // to store tower configuration

                    public static var data:ArrayCollection = new ArrayCollection();

 

 

                    private var intervalUnit:uint;

 

 

                    [Bindable]  

                    public var folderList:XMLList;

                    // BlazeDS variables

             [Bindable] public var channelUrl:String;  

            

              [Bindable] public var liveId:int=0;

            

                       [Bindable]

                       public var emailOrSmsMessageFormat:String = "";

 

                    [Bindable]

                    private var escalationEditOption:Boolean = false;

 

                    [Bindable]

                    private var swapCount:int = 0;

 

//  ---------------------------- To Control Session ------------------------- //

        public var myTimer:Timer;

 

                    private function initTimer():void

                    {

                               myTimer = new Timer(1800000);

                         myTimer.addEventListener("timer",logout);

                         this.addEventListener(MouseEvent.MOUSE_MOVE, resetTimer);

                         myTimer.start();

                    }

 

                    private function logout(event:Event):void

                    {

                              this.addEventListener(MouseEvent.CLICK,forward);

                    }

 

                    private function forward(event:Event):void

                    {

                              navigateToURL( new URLRequest("jsp/checkin/index.jsp"),"_self");

                    }

 

                    private function resetTimer(event:Event):void

                    {

                              myTimer.reset();

                        initTimer();

                    }

//  ---------------------------- To Control Session ------------------------- //

//**************************************************************************************** ***********************************************//                      

                        /**

                        * This method will be called as soon as SWF loads in the browser , creating a AMF channel which communicates to Java

                        **/

                        private function loadValues(mouse:MouseEvent):void{   ----------------------------------------------------------------->> When i enter Event to the loadvalues function i'm getting that error

                                        ticketViewStack.selectedChild = liveTicketVBox;

                                  userID = Application.application.parameters.userId;

                                  customertId = Application.application.parameters.customerId;

                                         if("true" == Application.application.parameters.escalationEditOption.toString()){

                                            escalationEditOption = true;

                                  }

                                        channelUrl = "./messagebroker/amf";

 

                                           /*

                                         userID = 92;

                                  customertId = 3;

                                           escalationEditOption = true;

                                          channelUrl = "http://172.16.1.144:5009/messagebroker/amf";

                                           */

                            var cs:ChannelSet = new ChannelSet();

                                        var customChannel:AMFChannel = new AMFChannel("my-amf",channelUrl);

                                        cs.addChannel(customChannel);

                                        remoteObject.channelSet = cs;

                                        remoteObject.getEscalationMaster();

                                        cursorManager.setBusyCursor();

                                        remoteObject.getAllLiveEscalationDetails(userID,customertId,displayTo wer.selectedItem.data,ticketType.selectedItem.data);

                                        cursorManager.removeBusyCursor();

                                        displayTower.selectedIndex = 0;

                                        refereshTime.selectedIndex = 0;

              

                        }

Open an image in default app

$
0
0

Hi

 

I have a air app and would like to know if it is possible to open an image that resides on a server in the current pc's default app with out loading it or anything - click button = open directly.

currently I'm using navigateToURL(new URLRequest('FILE PATH')) and opens as expected in a browser but I want it to open as if opened directly...

 

Thanks.

How to unload a FlvPlayback component

$
0
0

What are steps to do unload a flv file after clearing necessary memory used for its loading and also to remove the FLVPlayback component.

 

This is the code i have used for creating FLVPlayback component and setting its source.

 

public  var m_flvPlayer:FLVPlayback;

 

m_flvPlayer= new FLVPlayback();

 

m_flvPlayer.autoPlay = false;

 

m_flvPlayer.source ="FileName.flv" ;

 

addChild(m_flvPlayer);

 

//Actions attached to unload button

 

    m_flvPlayer.stop();


    m_flvPlayer.autoRewind = true;

 

     m_flvPlayer.getVideoPlayer(0).close()

 

     removeChild( m_flvPlayer );//clears FLVPlayback component.

 

Is there any other important step that we have to do for safe unloading of FLVPlayback component ?

FLVPlayback: Restart by clicking stopped video

$
0
0

The below code is used to bring up the video initially, stop it after rendering, then restart upon clicking the video component.

 

Unfortunately the statement "myVideo1.addEventListener(MouseEvent.CLICK,start1);" does not call function start1 upon the mouse click.

 

Any help would be appreciated.

 

package code{

//fades in, after fade in video stops

import fl.video.*;

import flash.display.*;

import flash.events.Event;

import flash.events.MouseEvent;

 

public class VideoDevCode extends MovieClip {

var myVideo1:FLVPlayback = new FLVPlayback();

 

public function VideoDevCode() {

myVideo1.source="NLSequenceAsm300h.flv";

//**myVideo1.setScale(.5,.5);

addChild(myVideo1);

//myVideo1.alpha=0;

//myVideo1.addEventListener(Event.ENTER_FRAME, fadeInVideo1);

myVideo1.stop();

myVideo1.addEventListener(MouseEvent.CLICK,start1);

 

 

}

 

function fadeInVideo1(event:Event):void {

myVideo1.alpha+=.04;

if (myVideo1.alpha>=1) {

myVideo1.removeEventListener(Event.ENTER_FRAME, fadeInVideo1);

myVideo1.stop();

}

}

 

function start1(event:MouseEvent):void {

trace("clicked");

myVideo1.play();

}

}

}


Launching external exe in AIR

$
0
0

Need to launch an external program through Flash AIR. Tried reading up but are unable to get it working. Think there is something else I need to perform before launching my external file (exe). It is a exercise that is like a game.

 

var myApp:File = File.applicationDirectory.resolvePath("Hazards.exe");
var myAppProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
var myAppProcess = new NativeProcess();

myAppProcessStartupInfo.executable = myApp;
myAppProcess.start(myAppProcessStartupInfo);

 

Throws this error when I run it inside Flash. And nothing after launching. In some debug I see that NativeProcess.isSupported = false;

 

Error: Error #3219: The NativeProcess could not be started. 'Not supported in current profile.'
at Error$/throwError()
at flash.desktop::NativeProcess/start()
at launching_fla::MainTimeline/launchFile()[launching_fla.MainTimeline::frame1:27]

 

How do I get a external file to launch with AIR?

 

 

 

THANKS

error 1120 and 1180 when trying to display number on the stage.

$
0
0

Hello, I am trying to develop a program that will place random numbers on the stage and ask the user what is the difference, sum, product, etc.  The program so far is as follows:

 

import flash.display.MovieClip;
import flash.text.TextField;

function randomNumber(low:Number, high:Number):Number
{
  return Math.floor(Math.random() * (1+high-low)) + low;
}

var add1rand:int = randomNumber(0, 10);
radnum_txt:text = format(add1rand);

 

The numbers get generated but when I try to display them I get the following error:

 

Scene 1, Layer 'Layer 1', Frame 1, Line 10 1120: Access of undefined property text.

Scene 1, Layer 'Layer 1', Frame 1, Line 10 1180: Call to a possibly undefined method format.

 

I have been trying for two weeks and reviewed comments from the adobe community and google searches.  My system uses an AMD Phenom 9950, Quad core processor with 8GB of ram and the hard drive is a convair 128 SSD.  The operating system is Windows 7 with SP1, and the flash program is Flash professional CS6, ver. 12.0.2.529.  Thank you. 

Flash CS6 start and stop button coding AS3??

$
0
0

I need to use Flash for a uni assignment, I have just started using Flash so this is a beginner question.

 

For my assignment I need to create a bouncing ball animation and then add stop and start buttons. So I created the buttons by drawing rectangles and then converted it to a symbol and made it a button. I have tried all the coding snippets that I can find and most of the time comes up as a 1086 Syntax error. The coding I've been using is:

For the play button:

on(release){

  play();

}

 

For the stop button:

on(release){

  stop();

}

 

Can you please tell me what I'm doing wrong?

Run Function on enter frame

$
0
0

When I use the following code:

 

addEventListener(Event.ENTER_FRAME, ImportantFunction);

 

function ImportantFunction(event:Event):void // Main Function

{

    //Function in here

}       

 

I get the following error.

 

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

 

The program still works but the error concerns me.  I can call the same function using a button click or object change with no problems.

 

What am I doing wrong?

Adobe Air load external swf with actionscript not working in iOS

$
0
0

Dear All,

 

I'm working on adobe air project for iPad app. I'm loading multiple external swf files which will download from the server in runtime. Downloaded files has actionscript and it doesn't work in the app. I have read some forums and it says that iOS doesn't Allowactionscript Byte Code(ABC) from the downloaded external swf. And that forums seems very old. Still the same status continues or Is there any solution found in latest for that? Please help me.

 

Thanks in advance,

Guru

Fade out music after playing for a minute AS3

$
0
0

I have a simple game I'm making and in it I want music to play for a minute and then fade out and then go to another frame. Here is the relevant code:

 

var songReq:URLRequest = new URLRequest("name.mp3");

var song:Sound = new Sound();

song.load(songReq);

var thesong:SoundChannel = new SoundChannel();

 

 

function startGameTimer():void {

     trace("GAME TIMER STARTED");

     var gameTimer:Timer = new Timer(60000, 1);//1min

     gameTimer.addEventListener(TimerEvent.TIMER_COMPLETE, endGame);

     gameTimer.start();

}

 

 

function endGame(e:TimerEvent){

     trace("GAME TIMER ENDED");

     thesong.stop();///want this to fade instead

     var endTimer:Timer = new Timer(4000, 1);//fade out before transition

     endTimer.addEventListener(TimerEvent.TIMER_COMPLETE,changeFrames);

     endTimer.start();

}

 

 

function changeFrames(e:TimerEvent){

     gotoAndStop(5);

}

 

 

what do I add/change to make the music fade out instead of suddenly stopping? I've been told I do something with tween but I don't know how that works if someone can help me out. Thank you

URLLoader generates error #2048 depending on file contents

$
0
0

 

Hi,

 

I’ve come across an intriguing problem and would be interested to know if anyone else has experienced this before, or has any opinions or suggestions.

 

I’ve developed a preloader for an ActionScript 3 application that uses URLLoader to load an encrypted swf. This has been tested on different OSs, Flash Players and browsers and everything works as expected except for a series of PCs being used by a colleague on a corporate network. The PCs at fault use Flash Player 10.0.22.87 with IE6 on WinXP and get security sandbox error #2048 depending on the contents of the file being loaded! Some of the tests and results include:

 

  • removing 99% of the contents but keeping first 6k (works)

  • replacing contents with 4 bytes 00 (works)

  • inserting 16 bytes: EF BB BF <html></html> at beginning of file (works)

  • inserting 16 0s at the beginning of the file (fails)

  • xor FF all bytes (fails)

 

I’ve tried other tests such as different file extensions, Security.allowDomain(“*”), crossdomain.xml, Security.loadPolicyFile(…), dataFormat = URLLoaderDataFormat.BINARY etc but I think these are all irrelevant due to the fact that the app sometimes works.

 

The code is just the standard new URLLoader(), adding event listeners, then calling load(new URLRequest(…)). The test app doesn’t include the loadBytes() so this isn’t the issue either.

 

The PC at fault could be behind a firewall or using a proxy. At this stage my only theory is that their antivirus, firewall or proxy is examining the contents and sometimes decides to “intervene”, perhaps with a redirect. This would also explain why (according to the web server logs) the files are being requested even though the security sandbox error is generated. However, this does not explain why Flash generates the error in the first place, depending on the contents.

 

It’s not possible for me to visit on site or get them to modify their settings or configuration, but I can ask them to run various Flash Apps for testing.

 

This bug report filed 12 months ago has some similarities, (including same FP version), but is unrelated I think:

 

http://bugs.adobe.com/jira/browse/FP-2264

 

I can come up with a workaround (such as ensuring the file always starts with dummy <html> tags and then strip them before decrypting), but I’d prefer to get to the bottom of this issue if possible to be confident it won’t occur again; this is for a Facebook application so it’s possible it will be used in a large variety of environments.

 

If anyone has come across this before, or has any ideas, it'd be great to hear from you.

 



TypeError: Error #1006: value is not a function.

$
0
0

I'm getting this error:

 

TypeError: Error #1006: value is not a function.
    at project_fla::MainTimeline/createMap()
    at project_fla::MainTimeline/frame1()

 

 

 

heres the actionscript:

 

[A]

function createMap(target:Object, map:Array, tilesize:Number):void {
    for (var ix:Number=0; ix<map[0].length; ix++) {
        for (var iy:Number=0; iy<map.length; iy++) {
            this["t"+String(ix)+"x"+String(iy)] = new Object();
            this["t"+String(ix)+"x"+String(iy)] = new tile();
            this["t"+String(ix)+"x"+String(iy)].gotoAndStop(map[ix][iy]);
            this["t"+String(ix)+"x"+String(iy)].x = Flxy(new Point(ix,iy), tilesize).x;
            this["t"+String(ix)+"x"+String(iy)].y = Flxy(new Point(ix,iy), tilesize).y;
            target.addChild(this["t"+String(ix)+"x"+String(iy)]);
        }
    }
}

{/A]

 

What's wrong with the code?

new Date().getTime() is returning a negative number

$
0
0

f I trace new Date().toUTCString() I get something like: Fri Aug 12 07:14:06 2011 UTC. perfect. If I trace new Date().getTime() I get some long negative number which is decreasing as I continue to trace it. This is totally unexpected. Obviously my system clock is OK. What gives?

error when opening url intenet with as3

$
0
0

When I run the file to open a url, this error appears:

 

flash adobe interrupted an insecure operation. is trying to communicate with this Internet-enabled location

 

erro_as.png

 

Can you help me?

How to add URL links in XML file?

$
0
0

Hi,

 

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

 

I'm using the following code:

 

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

 

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

Output:

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

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

 

 

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

 

Thanks for your time.

How to load External swf file in AIR

$
0
0

I try this code its working in computer but when I publish this file in .apk or .ipa , my external swf file is not opening

(I include my external file as well)

 

 

places_btn.addEventListener(MouseEvent.MOUSE_DOWN, newvid);

 

function newvid(event:MouseEvent) {

     trace("you clicked me");

     var loadit = new Loader();

     addChild(loadit);

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

}

 

 

01.jpg

Viewing all 18626 articles
Browse latest View live


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