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

Syntax error: expecting semicolon before 1 (1086)

$
0
0

Hello Guys,

 

I am trying to import some graphics symbols into one overall movie clip. For the rest of my project this has worked however for this one movie clip it does not work.

 

If I do not use the movie clip the entire movie will export fine and will work. However as soon as I drag the move clip onto the stage the compiler gives the following error.

 

tempInit, Line 2, Column 111086: Syntax error: expecting semicolon before 1.

This got me confused because my movie clip is called "All Of Them", I do not have anything in my library called tempInit.

 

The movie clip has no code on it.

 

How do I fix this problem?

 

Thanks,

 

Thomas.


Actionscript 3 error with classes.

$
0
0

Warning: Source path "$ (AppConfig) / ActionScript 3.0 / Classes" does not go to a valid directory.

 

Warning: The Library Search path "$ (AppConfig) / ActionScript 3.0 / Classes" does not go to a valid directory.

 

Tried to export a SWF, and this showed up each time, anyone that knows how to fix this?

Would be nice to have an Animate sub-community: Animate for building AIR Application

$
0
0

Just proposing an Animate sub-community

object doesn't support this property or method

$
0
0

Hi all,

I'm testing AS3 calling Javascript. It works in FF but not in IE8. I'm suspecting is a version problem but not sure.Can someone take a look? TIA  -s

Here is my environment:

OS: Win7 Pro 64bit.

CS4 installed.

then Flash player updated to 11.1 (no touch to the CS4 Flash installation dirs).

 

Here is the AS3 code:

import flash.external.ExternalInterface;

flash.system.Security.allowDomain("*");

startTest();

function f0():Boolean {
ExternalInterface.call("ff1");
return true;
}
function startTest():void {
if (ExternalInterface.available) {
  try {
   ExternalInterface.addCallback("f100", f0);
  } catch (error:Error) {
   trace("An Error occurred: " + error.message + "\n");
  }}}

 

Here is Javascipt part:

<script type="text/javascript">
   function ff1()   {    alert("From AS")   }
function f101() {    window.setTimeout(f100, 2000)   } 
  function f100(){
   var a=document.getElementById("fltest");
  a.f100() // got error message here
  }
window.onload= f101;
</script>
</head>

<body>
<div id="test"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#ve rsion=10,0,0,0" width="215" height="318" id="fltest" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="test.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#ffffff" /> <embed src="pet.swf" quality="high" wmode="transparent" bgcolor="#ffffff" width="215" height="318" name="fltest" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" />
</object>
</div>

TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::MovieClip@64e6ca1 to fla

$
0
0

Hi all,

 

I'm getting this error pop-out window when I pressed on a button. The button listener contains the following code:

 

 

btn_start.addEventListener(MouseEvent.CLICK, gotoStart);
function gotoStart(e:MouseEvent):void{      btn_start.removeEventListener(MouseEvent.CLICK, gotoStart);     gotoAndStop("START");
}

 

 

 

TypeError: Error #1034: Type Coercion fai led: cannot convert flash.display::MovieClip@64e6ca1 to flash.display.SimpleButton

 

 

at flash.display::MovieClip/gotoAndStop()

at attendanceCheck/gotoStart()[attendanceCheck::frame2:31]

 

 

After searching for the cause for a while, I can't find what is wrong with it...

Help me please...

 

Thanks,

Zainuu

Listen for value variable changing

$
0
0

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

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

obj.myNumber = 10;


obj.addEventListener(MyEvent.CHANGE_VALUE, myFunc);


obj.myNumber = 25;
[/code]

Loading external swf into Air App

$
0
0

Hi All,

 

I'm building an Adobe Air App for desktop and am having problems loading an external swf. Every time i try to load i get:

 

SecurityError: Error #2070: Security sandbox violation........ cannot access Stage owned by app....blah blah

 

The file that is being loaded is in a local directory, but as i understand its in a different 'sandbox' which is a security risk.


Is there any way around this?!


Any help would be much appreciated


Many Thanks


Matt

AS3 Unloading external SWF piling up problem

$
0
0

I have two buttons on main SWF what loads and Unload two external SWFs back and forth.

 

Also one timer function is calling external Screen saver SWF and unload the existing one when no interaction found.

 

I am using unloadAndStop() function to unload the external SWFs.

 

But after loading and unloading external SWFs, I am facing piling up or stack overflow problem.

 

Any help will be highly appreciated.

 

Thanks

import flash.net.NetConnection;

import flash.net.NetStream;

import flash.media.Video;

import flash.display.MovieClip;

import caurina.transitions.*;

import flash.utils.Timer;

import flash.events.*;

 

var myLoader_Map_1:Loader = new Loader();

var myLoader_Map_2:Loader = new Loader();

var myLoader_Screen_Saver:Loader = new Loader();

 

var Ss:Boolean = false;

var Maps:Boolean = true;

 

//--------------------Screen Saver---------------------------------

 

ScreenSaver();

 

 

  function ScreenSaver():void{

  var url:URLRequest = new URLRequest("screensaver.swf");

  myLoader_Screen_Saver.load(url); 

  addChild(myLoader_Screen_Saver);

  setChildIndex(myLoader_Screen_Saver, 1);

  Maps = false;

  Ss = true;

  

  }

  

  function ScreenSaver_Unload():void{

  myLoader_Screen_Saver.unloadAndStop();

  

  }

  

//--------------------Map Buttons---------------------------------

 

 

function MPstart():void{

  

  Tweener.addTween(MC_Maps_Btns,{alpha:1, x:778.25, y:1070.65, time:1, delay:1, transition:"easeOutCubic"});

  setChildIndex(MC_Maps_Btns, 2);

  

  MC_Maps_Btns.Btn_Map_1.visible = true;

  MC_Maps_Btns.Btn_Map_2.visible = true;

  

}

 

function MPclose():void{

  

  Tweener.addTween(MC_Maps_Btns,{alpha:0, x:778.25, y:1179.85, time:1, transition:"easeOutCubic"});

  

}

  

//--------------------Map 1 ---------------------------------

 

MC_Maps_Btns.Btn_Map_1.addEventListener(MouseEvent.CLICK,OpenMap1);

 

 

  function OpenMap1(e:MouseEvent):void{

  

  

  var url:URLRequest = new URLRequest("Map_1.swf");

  myLoader_Map_1.load(url);

  myLoader_Map_1.alpha = 1;

  addChild(myLoader_Map_1);

  setChildIndex(myLoader_Map_1, 2);

  

  myLoader_Map_2.unloadAndStop();

  ScreenSaver_Unload();

  

  Maps = true;

  Ss = false;

  

  MC_Maps_Btns.Btn_Map_1.visible = false;

  MC_Maps_Btns.Btn_Map_2.visible = true;

  

  

  }

//--------------------Map 1 ---------------------------------

 

MC_Maps_Btns.Btn_Map_2.addEventListener(MouseEvent.CLICK,OpenMap2);

 

  function OpenMap2(e:MouseEvent):void {

  

  

  var url:URLRequest = new URLRequest("Map_2.swf");

  myLoader_Map_2.load(url);

  myLoader_Map_2.alpha = 1;

  addChild(myLoader_Map_2);

  setChildIndex(myLoader_Map_2, 2);

  

  myLoader_Map_1.unloadAndStop();

  ScreenSaver_Unload();

  

  Maps = true;

  Ss = false;

  

  MC_Maps_Btns.Btn_Map_2.visible = false;

  MC_Maps_Btns.Btn_Map_1.visible = true;

  

  }

 

//--------------------Timer ---------------------------------

 

var inactiveTime:int = 10000;

var t:Timer = new Timer(inactiveTime);

 

stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown1);

t.addEventListener(TimerEvent.TIMER, onTimer);

t.start();

 

  function onMouseDown1(e:MouseEvent):void {

  t.reset();

  t.start();

  trace("Interaction detected");

  }

  

  function onTimer(e:TimerEvent):void {

  handleInactivity();

  

  }

  

  function handleInactivity():void {

  trace('You\'re inactive.');

  

  if (Maps == true){

  

  myLoader_Map_1.unloadAndStop();

  myLoader_Map_2.unloadAndStop();

  }

  

  else{

  trace("No Maps");

  }

  

  if (Ss == false ){

  

  ScreenSaver();

  MPclose();

  }

  

  else{

  trace("ScreenSaver already loaded");

  }

  

  

  }


How to make the counter never go below Zero or how to count negative number

$
0
0

So I have this counter that I made which basically counts points but it also subtract points. sometimes in certain conditions the counter goes below zero and then I get a weird number 4294967266. my goal is to make counter remember negative numbers but if it's too defunct at least to stop at Zero.  Any Ideas?

 

here is my counter:

 

//Scoreboard starts here:

var score: uint;

score = 100;

scoreBoard.text = "" + score.toString();

 

button_10.addEventListener(MouseEvent.CLICK, on_press1);

button_11.addEventListener(MouseEvent.CLICK, on_press2);

 

//Positive button adding points

function on_press1(event: MouseEvent): void {

  gotoAndStop(2);

  score += 100;

  scoreBoard.text = "" + score.toString();

 

  gotoAndPlay(61);

}

//Negative button subtracting points

function on_press2(event: MouseEvent): void {

  score += -20;

  scoreBoard.text = "" + score.toString();

 

 

}

//Scoreboard ends here:

Opposite of while?

$
0
0

So, I was working with the collision detection in my game and something came up -

I had to change an if statement to an while statement. Simplified code follows:

 

if(colision)                                             while(colision)

{                                                            {

player.y -=5;                                             player.y -=5;

playerColided = true;                                 playerColided = true;

}                                        ------------>       }

else                                                       ???

{                                                            {

playerColided = false;                              playerColided = false;

}                                                            }

 

Once I changed to while, I could not find something to do the "else" role, like "while not" or something like that, in a manner that while the while statement is not active, the playerColided Boolean becomes false. Is there an statement that can do this?

 

Thanks in advance, Dan.

Flash ActionScript 3.0 stop all movie clips

$
0
0

Hello everyone. I was hoping someone could share some AS3 knowledge with me

 

Situation - I have multiple frames. Each frame contains a movieclip. Each movie clip has audio and a seeker bar. There is a back and next button to go between the frames on the main timeline.

Issue - When pressing back or next button, movieclip audio does not stop and it overlaps to the next or previous frame!

Desired outcome - When clicking the next or back button, it will stop 'any' movieclip that is playing prior to moving to next or previous frame.

I suspect I will be having a lot of frames (therefore a lot of movie clips), so individually coding each back/next button per frame for one specific movieclip is a bit of a hassle and proving to be buggy at this stage.


Question - Is there, and if there is, what is the function to make all movieclips stop playing?

e.g

function next(Event:MouseEvent):void{

     <stop(); all movie clips>

     nextFrame();

}

 

next_btn.addEventlistener(MouseEvent.CLICK, next);

 

 

Thanks everyone! Your insight is most welcomed and will be appreciated.

I'm getting a Warning 5002 when publishing both swf and swc. Why is that?

$
0
0
, Line 1, Column 1Warning: 5002: The frame scripts of the symbol 'Options' have been ignored because a compiled clip contains a definition for Options. To override the Options definition, place a custom class file within your classpath.

After I've deleted ALL swf's and swc's in the same folder there's no warning. Then after I've published swf and swc again the warning pops up again....It started with Flash CC. Never happened when I was using Flash CS4

Transparent button over video background

$
0
0

Is it possible to overlay buttons over top of the MP4 video component in an HTML5 canvas project?  When I tried they were hidden underneath. Even though on top in timeline.

 

Trying to create a video player with looping background and when user touches screen anywhere timeline goes to menu.  (the old Encore DVD days, I know )

 

thanks in advance, rg

Is convert string to executable code possible?

$
0
0

Hi All,

 

Is it possible to convert string as executable code? like the below one.

 

For ex:

 

var fun1 = 'function myFun(arg){

     trace(arg);

}'

 

execute(fun1);

 

Thanks,

Guru

ActionScript code to close the program

$
0
0

Does anyone know the ActionScript code to close the .swf file?  I want the user to be able to click on a button, which will call a function that closes the .swf file, but I don't know the correct method to use.  Using the structure below, what code would go inside the function?

 

exit_btn.addEventListener(MouseEvent.CLICK, closeProgram);

functioncloseProgram(event:MouseEvent):void   {      


}


What are you using AS3 for in 2019?

$
0
0

Hey folks,

 

I was a big AS2/AS3 user back in the day. I've been in the HTML5 / JavaScript world for the past 7 years and have been pretty much in the dark about anything relating to AS3 and AIR. I still think AS3 is great and I have my own personal use cases where it still has merit.

 

However, I'm curious where it stands in the marketplace and figured this would be a great place to ask.

 

2 Questions

 

Are you currently doing paid work with ActionScript 3.0?

If so, in what type of projects are you using ActionScript 3.0?

 

I'm asking out of genuine curiosity as my hunch is that market demand has died down considerably, however looking at this forum it looks like folks are still using and learning it (which is cool)

 

Looking forward to your thoughts and feedback.

 

Thanks


Carl

Get UIComponent by id or name, the getChildByName does not return childrent of children

$
0
0

My application will load an xml file that has the name or id of a UIComponent. Later this will be used to set text or images.

 

This component could be on a panel or a panel in a panel, I am not familiar with flex but in javascript getElementByid would return the element wherever it is on the document (when called on the document). There is no get....Byid in fex and getChildByName does not look in children.

 

For example

    <mx:Text name="works" id="works"></mx:Text>
    <mx:Panel>
        <mx:Panel>
            <mx:Text id="noWorkie" name="noWorkie" text="a test"></mx:Text>
        </mx:Panel>
    </mx:Panel>

this.getChildByName("works"); // works
stage.getChildByName("works"); // returns null
this.getChildByName("noWorkie"); // returns null

 

 

 

Thinking of creating a getElementByid but has to be called from the top element, have no idea what the top element is.

For example this.root does not have a getChildren method to go through nor does stage. Guess I need to find the highest possible Container class starting with this.parent.

 

There must be a "simple" way to do this but all examples I could find would not go from top level to lowest child as javascript would do in document.getElemetByid.

 

Thanks for reading.

Dynamic Text and changing Text in AS3

$
0
0

I have a Dynamic Text box in my Library.  I drag it to my main stage and give it a name..it is now a movieclip. The name is 'mcAdmin'.  I added an event listener for MOUSE_OVER.  I want the text to change color, but for now I'm just trying to change the text; however, it's not displaying the change in text I want.  I do a trace, and the change is in there on the output window, but it is not displayed as such.  How can I :

 

1) use AS3 to change the font color of the text

2) use AS3 to change the text and have it display?

 

function onMouseOver_txtAdmin(e:MouseEvent):void
{
Mouse.cursor="button";

//Current mcAdmin text is 'Administration'

//I want to change the color of Administartion on Mouse_Over

//but to test if I can get to anything, I'm just trying to change the text.


mcAdmin.text="Hello";
trace(mcAdmin.text);


mcPPMB.alpha=.5;
mcASB.alpha=.5;
mcISO.alpha=.5;
mcEA.alpha=.5;
mcAdmin.alpha=1;

mcAdmin.scaleX=1.25;
mcAdmin.scaleY=1.25;
}

 

Thanks.

how can i have a pop up message in flash?

Restarting an FLV while it is playing

$
0
0

Hello all,

 

Ok I have been all over the web and havn't really found what I need. I have created an interface that plays videos when the buttons are clicked. Everything works great. I am using the FLVplayback component for each video. The client would like to be able to restart the video using a button. The scrubber apparently not enough. Is there an easy way to restart the FLV after it has begun playing. I just need to have it restart the video from the beginning. I know there is a skin that does this but it is not what the client wants and I have notice the right arrow of the skin is a bit buggy. Anyway, please let me know if there is a simple script I can use to restart the beginning using a button (ie "restart video"). I am a complete newbie with actionscript so I can only assume there is a simple solution to my problem.

 

Thank you in advance for any reponses or advice.

Viewing all 18626 articles
Browse latest View live


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