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

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

$
0
0

The problem I’m having is when I run the program and click on button3 to bring me to page3, I get the error message:

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

                at Untitled_fla::MainTimeline/frame1()

                at flash.display::MovieClip/gotoAndStop()

                at Untitled_fla::MainTimeline/gohome1()

I’m just trying to use button3 to bring me to the third page which is page3. Everything else is working fine. Any help would be great!

import flash.events.MouseEvent;

import flash.net.URLRequest;

 

 

stop();

home1.addEventListener(MouseEvent.CLICK, gohome1);

function gohome1 (event:MouseEvent):void{

   gotoAndStop(1);

}

  1. bios.addEventListener(MouseEvent.CLICK, gobios);

function gobios (event:MouseEvent):void{

   gotoAndStop(2);

}

button3.addEventListener(MouseEvent.CLICK, goabout1);

function goabout1 (event:MouseEvent):void{

   gotoAndStop(3);

    

}


TypeError: Error #1010: A term is undefined and has no properties. i try look all the code but still cant find any

$
0
0

TypeError: Error #1010: A term is undefined and has no properties.

at draganddrop_fla::MainTimeline/frame2()[draganddrop_fla.MainTimeline::frame2:19]

 

 

 

import flash.events.MouseEvent;

import flash.display.MovieClip;

import flash.media.Sound;

import flash.utils.Timer;

import flash.events.TimerEvent;

 

 

var obArray:Array = new Array(ob1,ob2,ob3,ob4,ob5.ob6,ob7,ob8);

var tArray:Array = new Array(t1,t2,t3,t4,t5,t6,t7,t8);

var posArray:Array = new Array();

var score:Number = 0;

var time:Timer = new Timer(1000); //1000ms = 1s

var totalSecond:Number = 0;

 

 

score_txt.text = String(score); //convert Numbers to String (text)

tim_txt.text = String(totalSecond);

 

 

for (var i:int=0; i<obArray.length; i++) {

obArray[i].buttonMode= true; // This is my line 19

obArray[i].addEventListener(MouseEvent.MOUSE_DOWN, pickObj);

obArray[i].addEventListener(MouseEvent.MOUSE_UP, dropObj);

posArray.push( {xPos:obArray[i].x , yPos:obArray[i].y } );

}

 

 

time.addEventListener(TimerEvent.TIMER,calcTime);

 

 

anyone can help me? i try all things delete and undo still error

Convert actionscript 1 to actionscript 3

$
0
0

Hi – can someone help with converting this Actionscript 1 to Actionscript 3

 

(Syntax error: expecting identifier before colon.)

 

loadMovie("leader.swf", "subHold");

lr1.gotoAndStop(1);

if (_root.links.:mlink==1) {

  play();

  _root.links.:mlink=0;

} else {

  stop();

}

 

 

And,

(Access of undefined property lr2)

 

lr2.gotoAndStop(1);

from as2 to as3

$
0
0

function standUp(target:MovieClip,delay:Number):Void{

target.interval=function(){

target._visible=true;

clearInterval(target.intervalID);

this.onEnterFrame=function(){

target._xscale=target._yscale-=25;

target._y-=(target._y-target.startY)/3;

if(Math.abs(target._y-target.startY)<1){

target._y=target.startY;

delete target.onEnterFrame;

}

};

};

target.intervalID=setInterval(target,"interval",delay);

target._xscale=target._yscale=400;

target.startY=target._y;

target._y=0;

target._visible=false;

};

/*function typewriter(target:MovieClip,delay:Number):Void{

target.interval=function(){

target._visible=true;

keyHit.start(0,1);

clearInterval(target.intervalID);

};

target.intervalID=setInterval(target,"interval",delay);

target._visible=false;

}

*/

function placeText(target:MovieClip,x:Number,y:Number,

  banner:String,tFormat:TextFormat,effectFunction:Function,delay:Number):Void{

//for each character

for(var i=0;i<banner.length;i++){

//create clip put each character in it

var char:MovieClip=target.attachMovie("letter","char"+i,target.getNextHighestDepth());

char.field.text=banner.substr(i,1);

char._x=x;

char._y=y;

//add the width of current text character to next char's x position-

x+=tFormat.getTextExtent(char.field.text).width;

//effect function call-passed in as a param

effectFunction(char,i*delay);

//delay between typing here-

//var timer=i*200+Math.round(Math.random()*200);

//typewriter(char,timer);

}

}

//var keyHit=new Sound(this);

//keyHit.attachSound("click");

var format:TextFormat=new TextFormat;

format.font="Arial";

format.size=24;

placeText(this,100,100,"Create EASY text animations",format,standUp,100);

placeText(this,100,120,"using only actionscript",format,standUp,100);

nextFrame();

Above how do I change this to Actionscript 3.0 from Actionscript 2.0  In bold I want a change to but how do I that. So please help me with it.

Error 1046

$
0
0

Please help and fix my mistakes

 

 

the error is:

 

1046: Type was not found or was not a compile-time constant: MouseEvent.

 

 

my code:

package
{     import flash.display.Sprite;     import flash.media.Camera;     import flash.media.Microphone;     import flash.media.Video;     import flash.net.NetConnection;     import flash.net.NetStream;     import flash.net.ObjectEncoding;     import flash.events.NetStatusEvent;     import flash.events.AsyncErrorEvent;      import flash.system.Security;      import flash.system.SecurityPanel;     public class MinCam extends Sprite     {            private var cam:Camera;            private var mic:Microphone;            private var vid1:Video;            private var vid2:Video;            private var nc:NetConnection;            private var ns:NetStream;            private var nsOut:NetStream;            private var nsIn:NetStream;            private var rtmpNow:String;            private var msg:Boolean;            private var customClient:Object;            public function MinCam()            {                   mic.addEventListener(MouseEvent.CLICK, settings);                                                      cam = Camera.getCamera();               mic = Microphone.getMicrophone();               rtmpNow = "rtmp://localhost/live";               nc = new NetConnection();               nc.addEventListener(NetStatusEvent.NET_STATUS, connected)               nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncHandler);                             //Camera Settings                  cam.keyFrameInterval = 15               cam.setMode (240,180,15,false);               cam.setMotionLevel (35,3000);               cam.setQuality (40000 / 8,0);                         //Microphone Settings               mic.gain = 85;               mic.rate= 11;               mic.setSilenceLevel (25,1000);               mic.setUseEchoSuppression (true);                            //Connect              nc.connect (rtmpNow);                            //Video Setup             vid1=new Video(cam.width,cam.height);             vid2=new Video(cam.width,cam.height);             addChild (vid1);             vid1.x=10,vid1.y=20;             addChild (vid2);             vid2.x=vid1.width+15,vid2.y=20;                        //Attach local video and camera             vid1.attachCamera (cam);                                            }          public function connected(Event:NetStatusEvent):void          {            trace("something happend");            switch (Event.info.code)            {                case 'NetConnection.Connect.Success':                nsOut = new NetStream(nc);                nsIn = new NetStream(nc);                customClient = new Object();                nsIn.client = customClient;                customClient.onBWDone = onBWDoneHandler;                trace("connected");                nsOut.attachAudio (mic);                nsOut.attachCamera (cam);                nsOut.publish ('camstream');                vid2.attachNetStream (nsIn);                nsIn.play ('camstream');                break;            }          }          public function asyncHandler(Event:AsyncErrorEvent):void          {               trace("In asyncHandler");          }                     public function onBWDoneHandler( eventObj:Object ):void          {               trace("** onBWDone :"  + Number(eventObj) + " kbps");          }            public function settings(Event:MouseEvent):void            {                 Security.showSettings(SecurityPanel.MICROPHONE);            }  }

}

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

$
0
0

It always warn me this message.

 

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

at MethodInfo-9()

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

at MethodInfo-12()

 

mycode is here:

 

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

this.stop();

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

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

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

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


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

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

}

can't import mx.graphics into Flash CS6

$
0
0

I'm use both Flash CS6 and Flash Builder 4.6.  In FB I can import mx.graphics.* into an .as file with no problem, but in Flash only mx.core is recognized.  How can I access mx.graphics in Flash?  Many thanks.

Action Script 3, how to create a start screen for a game

$
0
0

What code do I write to create a starting screen for a game? I want to create a screen were if play is clicked it moves on to the game


How do I make a countdown to a specific date using Animate CC 2015.1 Release?

$
0
0

I need this for a comic convention and we are trying to count down to June 17th, 2016. I tried the other forum resources and it gives me an error that the syntax isn't working with the new Animate CC.

 

I want it to be in terms of how many months, days, hours, minutes, and seconds it is.

 

Thanks!

Help! How to create a count up in Animate?

$
0
0

I'm creating an animated info graphic about tigers and need a count up from 0 to 3200 to show the current population of tigers in Asia.

This is my current Code:

 

import flash.display.*;
import flash.events.*;
import flash.utils.*;


var countUpInc:int = 20;  
var totalSecs:int = 1000;  
var count = 0;     
var countTimer:Timer = new Timer(countUpInc);  
countTimer.addEventListener(TimerEvent.TIMER, timerHandler);  
countTimer.start();      
function timerHandler(e:TimerEvent): void {    if (count !== 3200) {   
count = count + countUpInc;
counter.text = count;
trace(count);  }   
} 

 

the code runs in console but when line 19 is uncommented it crashes at 1280.

 

I get the error:

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

at TigerInfographic_fla::MainTimeline/timerHandler()[TigerInfographic_fla.MainTimeline::fram e210:17]

at flash.utils::Timer/_timerDispatch()

at flash.utils::Timer/tick() "

 

i don't know how to fix it.

.fla file: NBeaulieu_FinalAnimation.zip - Google Drive

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

$
0
0

Hi,

 

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

 

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


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

 

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

 

 

Please help....

Regards

Fullscreen with spacebar

$
0
0

Hey people,

 

Can anybody help me in finding a script that makes it possible for me to go fullscreen with the spacebar?

I'm a noob so I tried searching for it, but I only found mousekey full screen scripts.

 

Thanks!

 


Raoul

How to obtain instance name of Movie Clip?

$
0
0

Hello!

 

Is there a way to get the instance name of a move clip once it's on the stage?  In my dress up game, I need to know which items are on the doll in order to keep them visible.  My drag and drop feature uses an array and currentTarget:

 

 

var dragArray:Array = [Doll.Drawers.Dress1, Doll.Drawers.Dress2, Doll.Drawers.Dress3, Doll.Drawers.Dress4];                    for(var i:int = 0; i < dragArray.length; i++)             {                    dragArray[i].buttonMode = true;                    dragArray[i].addEventListener(MouseEvent.MOUSE_DOWN, item_onMouseDown);                    dragArray[i].addEventListener(MouseEvent.MOUSE_UP, item_onMouseUp);            }


function item_onMouseDown(event:MouseEvent):void 
          {               var clip:MovieClip = MovieClip(event.currentTarget);               clip.startDrag();          }  
function item_onMouseUp(event:MouseEvent):void           {               var clip:MovieClip = MovieClip(event.currentTarget);               clip.stopDrag();               if(clip.hitTestObject(Doll.Skins))                    {                             //Here's where the problem starts!   ----------------------------------------------  //                              trace("It's on the doll!");                    }          }

 

It can successfully run this code.  However, instead of tracing "It's on the doll!", I'd like to turn the currentTarget into it's instance name, which should be "Doll.Drawers.Dress1" etc... and then store that name in an array.

 

How would I do this?

 

I've looked into e.target.name, but I keep getting errors...

Event.CHANGE triggers twice on text input

$
0
0

Hello. I have an editable TLFTextField named "txt1" on the stage. I added an event listener for the Event.CHANGE, but  it fires twice each time I press a key. My code:

 

import fl.text.TLFTextField;

import flash.events.*;

 

var n:int = 0; //number of times the event has fired

 

txt1.addEventListener(Event.CHANGE, changed);

function changed($e:Event):void {

    trace ("text changed" + n++);

}

 

I test the movie and write some text on the txt1 text field.

Output:

text changed 0 //clicked on txt1, gained focus

text changed 1 //pressed "a"

text changed 2 //pressed "a"

text changed 3 //pressed "b"

text changed 4 //pressed "b"

...

 

Anyone knows why this happens?

 

Related: in this specific case my text field will allow the user to enter the width of an image, so I restricted it to "0-9". Whenever the number in the text field changes, some calculations are made. I thought of using TextEvent.TEXT_INPUT but since it doesn't dispatch for Delete or Backspace, I would have to use in combination with KeyboardEvent.KEY_DOWN and check for those keys, and it seemed simpler to use Event.CHANGE.

 

Thank you.

Very large file upload > 2 GB with Adobe Flash

$
0
0

Hello, anyone know how can I upload very large files with Adobe Flash or how to use SWFUpload?

Thanks in Advance, All help will be very appreciated.


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

$
0
0

For the external swf file loading, I use this code

 

 

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

 

load2.addEventListener(MouseEvent.MOUSE_DOWN, newvid);

function newvid(event:MouseEvent) {

          trace("you clicked me");

          var loadit = new Loader();

          addChild(loadit);

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

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

}

 

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

 

 

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

 

 

 

_______________________________________________________________

in AS2 we have

on (release) {

          loadMovieNum("scene2.swf", 1);

          unloadMovieNum(2);

          unloadMovieNum(3);

}

but i need in AS3

ClickTag problem with flash

$
0
0

Hi I am not a coder, and I need some coding help with google ClickTag parameters in AS3.

Any help would be greatly appreciated.

I’m doing a Flash banner for display network on google adwords, after completing the flash and tried to upload it to google I got this message:

 

ClickTag is required, but not found.

I went through clickTAG instructions from Google and got the code:

 

import flash.events.MouseEvent;
import flash.net.URLRequest;
// ......
someButton_or_displayObject_to_receive_mouseClick.addEventListener(
MouseEvent.CLICK,
function(event: MouseEvent) : void {
flash.net.navigateToURL(new URLRequest( root.loaderInfo.parameters.clickTAG), "_blank");
}
   );

 

aswell as changing the “someButton_or_displayObject_to_receive_mouseClick” with the actual name of button that will receive the click.

 

I added a layer and created a “symbol” button with a (hit) that covers the full banner.

Made sure the name of the property and the button are “button”

I got it to the front of the banner and added this code:

 

import flash.events.MouseEvent;
import flash.net.URLRequest;
// ......
button.addEventListener(
MouseEvent.CLICK,
function(event: MouseEvent) : void {
flash.net.navigateToURL(new URLRequest( root.loaderInfo.parameters.clickTAG), "_blank");
}
   );


I got no errors from flash professional and thought that it’s done.

But google adwords still say :

ClickTag is required, but not found.

When I upload it !

 

I tried adding “root”. And tried “ _level0” but it didn’t work and got error messages.

 

I tried everything I found on the internet to fix this problem, but I wasn’t able to ….

 

Would appreciate if anyone can help me out figure whats wrong!

Thanks in advance

Error # 1120, Access of undefined property ERROR. AS3

$
0
0

I have a code inside of an actionscript file, and i receive multiple errors when attempting to debug:

 

1120: Access of undefined property square.

1180: Call to a possibly undefined method addChild.

1120: Access of undefined property square.

1120: Access of undefined property square.

1120: Access of undefined property fl_click.

1120: Access of undefined property myTimer.

1120: Access of undefined property timerListener.

1120: Access of undefined property myTimer.

 

Here is my code for my main actionscript file:

 

package 
{    import flash.events.MouseEvent;    import flash.display.MovieClip;    import flash.utils.Timer;    import flash.events.TimerEvent;    public class Game extends MovieClip    {        public var myTimer:Timer = new Timer(50);        public var square:Square;        square.addEventListener(MouseEvent.CLICK, fl_click);        myTimer.addEventListener(TimerEvent.TIMER, timerListener);        myTimer.start();        private function timerListener(e:TimerEvent):void        {            square.edgeCorrect;        }        private function fl_click(event:MouseEvent):void        {            square.moveDownABit();        }        public function Game();        {            square = new Square();            addChild( square );        }

I am a beginner, so please tell me specifically what to do with my code, thanks!

1084: Syntax error: expecting rightparen

$
0
0

Hi folks

 

I am a real greenhorn here. I have just upgraded from CS3 to CS6 and had to edit a *.fla file in Flash CC. I saved it and exported as a *.swf  I now have about 40 compiler errors all of the same format "1084: Syntax error: expecting rightparen before and"

 

This is typical of the scenario

 

Location

Scene 1, Layer 'buttons', Frame 1, Line1. Column 17

 

1     if (_ymouse>202 and _ymouse502) {

 

Is it expecting a close of brackets before and ie  if(_ymouse>202)

 

Another example:

 

1     if (_xmouse>7 and _xmouse<24 and _ymouse<235 and text1.y<113

2     {text1.y_y+=4}

3     if _xmouse>33 and _xmouse50 and _ymouse<235 and text1.y>30)

4     {text1.y_y=4}

 

In this group, relating to Symbol definitions on a page labelled services-page it has the syntax error for Line 1, column 17  expecting rightparen before and, and also for Line 3 at column 16, just before the and.

Surely adding a bracket in that group of conditions before an "and" will mess up the "if" condition...

 

Any help will be graetfully appreciated!  (I can do screen grabs if it helps!)

targeting mcs not present on the current timeline

$
0
0

I have a very basic question but I can't seem to find the answer anywhere.

In AS 2 I used to be able to target any MC from any frame using its instance name but now if I target an MC from somewhere on the timeline where that specific instance is not present I get an error. How do I resolve this?

 

A specific example is using a set of text variables on frame 1 to label a bunch of different MC instances found elsewhere on the timeline.

Viewing all 18626 articles
Browse latest View live


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