Actionscript 3 :: Objects (buttons) From Library Not Accessible From Within Certain Functions?

Nov 18, 2011

I'm working on a simple image processor in AS3 and as usual I almost had it finished when an annoying little problem appeared. I want to open an image using a dialog box, and once the image is open I want the "selectBtn" (which is in my Library) to disappear. However when I try the code below I get a: "Error #1009: Cannot access a property or method of a null object reference". I'm sure it's something simple but I just can't figure it out!

// declare variables
var image:Bitmap;
var loader:Loader = new Loader();

[code]....

View 1 Replies


Similar Posts:


ActionScript 2.0 :: FMX-variable Accessible Outside Of Functions?

Aug 6, 2003

I don't know why the value of my variable my_str is undefined outside of this function:

loadText = new loadVars();
loadText.load("data.txt");
loadText.onLoad = function(success) {

[Code]....

ps: I tried making my_str a global function or even defining it as _root.my_str but I always get the same result..it's undefined outside the function...I need that value for something else so...

View 1 Replies

ActionScript 3.0 :: Loaded Library: Not Accessible By All

Mar 1, 2011

I have a swf containing several movie clips that are utilized without issue from one perspective. There happened to be one other angle (MenuBar) that these movie clips were to be used from but am not able to access them. The process that fails is:

1) Controller.swf loaded into currentDomain.

2) MenuBar.swf loaded into the currentDomain as child to controller.swf.

3) Clicking on an item on the MenuBar.swf runs a static process that attempts to access classes that are in the currentDomain and yet receive the error: ReferenceError: Error #1065: Variable 'variablename' is not defined.
at global/flash.utils::getDefinitionByName()

These items that are being accessed are avatar parts and are currently displayed on the screen as a child to the controller.swf. I also have a click event on the avatar itself which does execute and display the desired objects on the screen. If all swf's are loaded into the same application domain and are loaded as a child to the same display object then why would these assets not be available?

View 1 Replies

ActionScript 3.0 :: Import Vs Include - Basic Functions To Be In BasicFunctions.as And The Make A Library For More Specific Functions

Jun 6, 2010

I've got a project thats getting a bit big, so Im taking the actionscript out into separate as files. I want all the basic functions to be in BasicFunctions.as and the make a library for more specific functions. I find that a lot of people use the import statement but I cant get that to work with a simple Hello World trace, yet the include statement works fine (see attached). I understand that import/include work differently, but which is the better method? If import, then is that heavier to work with. Any rate, what's the best way to organise code when it gets to the 1000+ lines?

[Code]....

View 9 Replies

ActionScript 1/2 :: Buttons Is Not Accessible

Sep 18, 2010

I have several buttons within a flash file. The hierarchy is this:mainmcholder workmc service1mc.All three are separate swf's loaded into holders. Now within service1mc, there are several buttons..clicking any buttons loads another external swf, related to that button, within an emtpy movieclip which is placed above these buttons. Now when one button is clicked, all the buttons are disabled and dimmed. When the user closes the external button-related swf, all buttons are enabled and _alpha is made 100 again.Everything works fine till the external button-related swf is closed. The buttons are disabled and dimmed, but when the swf is closed, the buttons are inaccessible.

I have placed the code within onLoadInit(), wherein the external swf (_mc), has an event listener attached to it. When the event is dispatched, (which is successfully completed), a function is executed, which is enabling the buttons. The function is also getting executed, but the buttons are not reachable. It seems to be a path issue.[code]I have used the same path for disabling them, and that seems to work.

View 2 Replies

ActionScript 3.0 :: Load And Then Make Accessible As Buttons?

Oct 8, 2009

I have 12 pictures I need to load and then make accessible as buttons or - when the user presses on the picture it initializes a function.  What is the best way to do this?
 
I went the loading a picture through URLRequest and URLLoader route but I need to load 12, place them on the stage, make them move upon NextBnt press and and then when the user selects the picture., the view goes to another screen.

View 16 Replies

ActionScript 1/2 :: Buttons Inside Moveiclip Not Accessible?

Aug 1, 2010

I am making this website, which contains a load file, which contains a movieclip holder, which holds all the different parts of the website.
 
Now within the portfolio.swf, which is within mcholdr, inside load.swf, there are several images, which are buttons. On clicking one image, I have code which dims, i.e. reduces _alpha for all the buttons and disables them. Now when I test portfolio.swf alone, this code works, but when I access portfolio.swf through load.swf, the code is not working.
 
[Code]...

Nothing works. Is this a path problem??? How do I access these buttons?? I want to use the loop, as there are many buttons, so a simple img1._alpha will not work, as I will have to type this out for each button. How can I get the same effect using the loop??

View 2 Replies

Actionscript :: IDE - Radio Buttons On Stage Not Accessible From External

Sep 12, 2009

This one is a funny one. To replicate:

1.Drag a radio button onto the stage.

2.Name the instance.

3.Create a document class.

4.Try and set/change the label of the radio button from the document class.

I noticed this problem when I quickly knocked the code together to catch the radio button value through an event, which worked perfectly when the code was on the timeline. I tried to clean up the code into a class file, at which point it broke. I stripped the whole thing down to bare bones and just could not get the label or the value to set from the document class. If I've missed something, I'd love to hear it, as I've wasted hours AGAIN on a silly problem.

[Code]....

View 3 Replies

ActionScript 3.0 :: Flash Keyboard Accessible Menu / Buttons

Oct 26, 2010

I'm trying to build a class that can handle a menu or other grid of buttons being keyboard accessible (navigate with arrowkeys, select with another key, here 'b'). So far I have the keyboard part working, but you have to click one of the buttons to 'activate' it, and I am unsure of the logic needed to do the mouse events. I have added mouse events but don't see a simple way of integrating them with the keyboard system. Code is here, and both the class and a test .fla are attached.

Basically, the list of instances are passed by the frame into the constructor in an array. The selector class manages the index in the array of the currently selected button. The frame adds a key event listener, and these keys are picked up by the class to change the selected button and call the roll out and roll over methods to change the states (for this test just adjusting scale to 1.4, but in future, causing them to run a function or similar).

What I would ideally like, ideally, is for the keyboard and mouse to work in sync, as in rolling over with the mouse will update the currentButton index... If not, just some explanation as to why one of the buttons in the array must be clicked first before I can start using the keyboard would be good.

[Code].....

View 2 Replies

Flash - Timer Object With TimerEvent.TIMER Event Globally Accessible To All Objects?

Feb 16, 2012

I am working on a very simple game in Flash. I want to make all the animations framerate agnostic, so that I can change the framerate without affecting the flow and speed of the game.I read somewhere that if you want to do that, you simply create a Timer object and attach an event listener to this timer.

What if I have many objects that have to listen to the same timer? See the code to understand what I am trying to do. At this stage nothing breaks, but the event does not fire.Here is the Main class, the one that runs on swf execution:

public class Main extends MovieClip {
private static var _stage:Stage;
private static var _timer:Timer;

[code]....

View 1 Replies

Actionscript 3.0 :: Loading A Functions Library?

Feb 14, 2009

I am having a bit of a problem. I have my document class (documentClass.as) and a class for functions (functions.as).How would I go about importing functions.as so that I can use the functions in it?

View 2 Replies

ActionScript 1/2 :: Create Objects Using Functions?

Nov 21, 2009

I tried turning the following object (clear sake) into the product of a function (see below),however, my attempts to display any kind of output produces "undefined".[code]...

View 3 Replies

ActionScript 3.0 :: Layered Objects And Functions?

Sep 22, 2010

I have two movie clips on the stage: mcA and mcB, each have a function when rolled over:
 
mcA.addEventListener(MouseEvent.ROLL_OVER , aActivated);function aActivated (event:MouseEvent):void{     trace('mcA was rolled over');}mcB.addEventListener(MouseEvent.ROLL_OVER , bActivated);function bActivated (event:MouseEvent):void{     trace('mcB was rolled over');}
 
Under certain circumstances mcA may overlap mcB. When the cursor rolls over their intersecting area I would like both functions to launch, how do I do that? Currently, the problem is that only the object on the top will launch its function.

View 2 Replies

ActionScript 3.0 :: Accessing Objects In Other Functions

Jan 15, 2009

I'm working on a flash video player and I'm trying to figure out how to access something inside the constructor that I know is set but it keeps telling me its not.

[Code]....

now in the metadata function its giving me the error, "Access of undefined property video" Now, am I just completely not understanding how classes work or is this a common problem?

View 4 Replies

ActionScript 2.0 :: Remote Access Of Functions & Objects?

Sep 18, 2009

How do I access actionscript programs, such as functions, from remote as files without using the #include command?

View 0 Replies

Actionscript 3.0 :: Distance Between 2 Objects : Math. Functions?

Feb 18, 2010

often seen in simple flash games. So you can look at an example. http:[url]....Green object shots a bullet and what i want to acheive is to run bullet toward black bar even if bullet is shot to the left side of the screen. Bullet should make a circle, slow down and change direction to the bar and finally proceed faster and faster to the bar. Simply it should behave like remote control rocket chasing enemy. Right now i am with this: Code: Select all

function movingBull(e:Event):void [code].........

//of course i dont know what should be inside if statement

//to make the code work.

View 2 Replies

ActionScript 2.0 :: Making Own Functions For Objects And Movie Clips?

Dec 22, 2006

How would I go about making my own functions for objects and movie clips?

Like:

Code:
onClipEvent(enterFrame){
this.setpos(10, 20);
}

[Code].....

View 6 Replies

IDE :: Apply Event Listeners To Multiple Objects/functions?

Jun 24, 2009

I'm currently working on a nav bar but I've run into a questionable situation. There are several links in the menu, and for each i'd like a mouse event on over and on out. Do I have to specify both of these events for each link, or is there an easier way to do it that I don't know about? Can you apply event listeners to multiple objects/functions?

View 6 Replies

ActionScript 3.0 :: Flash Video Player - Accessing Objects In Other Functions

Jan 15, 2009

I'm working on a flash video player and I'm trying to figure out how to access something inside the constructor that I know is set but it keeps telling me its not.

Here is the code
Select allpackage player {
import flash.display.Sprite;
import flash.media.Video;
import flash.net.NetStream;
import flash.net.NetConnection;
import flash.utils.Timer;
[Code] .....

Now in the metadata function its giving me the error, "Access of undefined property video". Now, am I just completely not understanding how classes work or is this a common problem?

View 2 Replies

Actionscript 3 :: Getting A List Of Library Objects?

Feb 5, 2010

Is there a way to access or iterate through a list of all objects exported to ActionScript from the Flash IDE? I'm looking to save myself some hassle by just iterating through selected MCs and processing them in a certain way, without knowing their names.

View 5 Replies

ActionScript 3.0 :: Using Interface With Library Objects?

Nov 13, 2009

I was trying to set up library movieclips to extend an abstract class so they could share common methods, but can't, as all library movieclip objects have to extend MovieClip.My second thought was then to at least insure that all of these objects - which each need their own class now -- implement the same functions -- so I have the following

Code:

public class MyClass extends MovieClip implements MyInterface and then in MyClass I have a function that implements someFunction in MyInterface.I keep getting error 1044: Interface method someFunction in namespace MyInterface not implemented by class MyClass.

View 2 Replies

Use Variables To Call Objects From Your Library Onto Stage?

Nov 11, 2010

does anyone know if it's possible to use variables to call objects from your library onto stage like this:I have an object in my library called Level01 as is it's linkage

Actionscript Code:
var MyMap:String = "Level01";addEventListener(Event.ENTER_FRAME,LoadMap);function LoadMap(event:Event) { var myLVL:MovieClip = new MyMap();// how do you use the variable

[code].....

View 4 Replies

Professional :: Library Objects For Flash Document

Apr 2, 2010

I have a question about a library one would create inside a Flash document. I have a bunch of pieces of graphics objects inside a library for a FLA file. I then drag these pieces onto stage to build a more complex object. I then select all those pieces and group them and convert this new object into a movie clip. From there I move it into the library for that FLA file. I notice there is both a graphic for this object plus the movie clip for that object. To me these are 2 separate objects. So when I delete the graphic of the object, it also deletes the movie clip I created of the object.

View 5 Replies

Flex :: Library - Objects Floating At Top Of Canvas?

Jun 27, 2010

I want to have a canvas with some "floating" property. Basically when I add child to it, the child should float at the top. When I add the second child, it should float above the previous one. For example the canvas width is 100, and I have two VideoDisplay with width 100 and height 75.

canvas.addChild(video0);
// Or canvas.addChildAt(video0, 0);
// video0 should be at x=0 and y=0
canvas.addChild(video1);
// Or canvas.addChildAt(video1, 1);
// video1 should be at x=0 and y=0, while video0 x=0 and y=75

View 2 Replies

AS3 :: Good Library That Makes Objects Detection In It?

Aug 10, 2011

Does anyone knows a good library that makes objects detection in AS3?

Im looking for something similar to detect an hand, like kinectic.

View 2 Replies

ActionScript 2.0 :: Referring To Library Objects Via Classes?

Feb 26, 2007

I've been heavily mired in 3D recently, and decided to pay a visit back to good ole Flash.

My problem is this. I'm extending the MovieClipLoader class to create a Preloader Class (yes I'm sure it's been done fifty billion times but). I'm trying to refer to a symbol in a common library, the preloader symbol itself.

Inside my class I have this

Code:
function onLoadStart(target){
baseClip.attachMovie("preloaderTemplate_mc", "preloader_mc", 500, {_x:0, _y:20, _xscale:75, _yscale:75});
baseClip.preloader_mc.gotoAndPlay(1);
}

baseClip is a MovieClip object which takes a MovieClip passed to the constructor of the class in the FLA. (say a container movieclip which has a target clip preloaded into it) The class does load the target clip into the baseClip, but doesn't show the preloader, which makes me think I'm not referring to it properly.

View 4 Replies

ActionScript 3.0 :: Access Objects In Library Symbols?

Mar 15, 2011

I have a fairly complex symbol with a few moving parts, and I want to be able to access a label on the symbol to add text. When i just load the clip

PHP Code:
var x = new fm_Input(); // instanc in libraryaddChild(x);
it shows the default text.

[code].....

View 1 Replies

ActionScript 3.0 :: How To Group Buttons' Functions

Apr 22, 2009

I have lots of buttons on the stage but they all do the same thing, ie. CLICK & DOUBLE_CLICK.How can I group these functions so that if a button in a certain group is clicked then the functions of buttons in all other groups are disabled?

View 2 Replies

Professional :: Buttons With Multiple Functions?

Feb 26, 2010

I am building a Flash site with a boombox animation.  I have the below code I am using.  I am using just two frames.  First frame, is where I put the code in the actions layer, boombox is still.  In the second frame, I placed my movie clips on layers (woofers vibrating & tape deck spins).  No code in second frame.  So, if you hit the play, previous or forward button a song goes on and the animation start.  If you press the pause button, animations stop with music.  I have created 2 functions per button.
 
2 questions: 1 - Is this the best way to do it?  If I press the buttons quickly, sometimes a song gets stuck and I can't stop, forward, etc.  I was wondering if this was the code?
 
2 - I am tweening in my pages using AS3 - not timeline.  I have a music and video page (each a movieclip).  Is there a way that once I tween in the new movie clip (non-music of vid page) that the music or video can shut off?

[Code]...

View 3 Replies

ActionScript 3.0 :: 4 Buttons - How To Make 1 Functions For All Of Them

Dec 9, 2011

i have 4 buttons below

ActionScript Code:
home_btn.addEventListener(MouseEvent.CLICK, goto_home);
about_btn.addEventListener(MouseEvent.CLICK, goto_about);
portfolio_btn.addEventListener(MouseEvent.CLICK, goto_poftfolio);
contact_btn.addEventListener(MouseEvent.CLICK, goto_contact);

[code]....

View 9 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved