Accessing things on the stage
I have a movie clip on the stage. In the main .as file, I can
easily access the instance i.e., myMovieClip_mc.x = 10;
How do I do that from a class in my "classes" package? I am
passing the stage instance into the constructor of the class, so I
would think something like myStage.myMovieClip_mc.x = 10 would
work, but it comlains that it is null.
thanks
Are you using a document class?
In your example, is myState null or is just
myStage.myMovieClip_mc null?
Similar Messages
-
Imported SWF showing the things beyond the stage of the file
Hi, I need help.....fast
I have two older ( 2002 ) projects I have done in flash, have opened and reworked one in CS5
1st) is a banner animation document size 468 x 60 pixels, I have text that is flying in from way off stage.
2nd) is another animation using some photo images with movie clips, sound 800 x 600 pixels, this also has elements off the stage that fly in.
I am currently building a portfolio website for myself in Flash Catalyst,
(I'm not code literate).......anyway, that is working out great so far, the overall site is.......
950 x 800 inside that I have given a stage area for my work to show....that is just a shape in black that is 572 x 395
My problem:
When I test the movie in flash they both play every thing is fine.
When I import the SWF files into Flash Catalyst and place them where I want them to be and I " Run Project" the only thing going wrong is that all the stuff that usually does not show that is " off stage" in the grey area is visible.
How do I have the off stage stuff in the SWF files disapear and not change the visuals of the original or block out the backround layout creating in Flash Catalyst.
Thanks for any help ASAP.
StacyHi, Chris!
Thanks for giving it a thought but that didn't seem to help :/
I'll try recompiling it tonight in a few different ways to see if anything changes. I'm testing entirelly on the local drive.Still haven't tried uploading anything from that project to the web.
Just a s note - the swf is entirely powered by the two .as files (because it just renders some words from an xml) so maybe there might be an issue if the file doesn't really contain much (although i tried putting some colored boxes inside and it didn't help).
I'll post links to the .fla and the .as files later today. -
Hello,
I am using the ActionScript 3 in a aplication and i have
problem to access the MovieClips that is on the Stage. Let me
explain.
I the stage i have two MovieClips, with instance of mc1 and
mc2. Inside of mc1 i try to access some proprerties from mc2 but
without success.
I try using this:
trace(parent.mc2.width);
But the Flash return the error 1119, undefined propertie.
So, how can i access the MovieClips that is on my stage from
another MovieClip.
Thanks:
-
Access object on the stage using an as3 widget
I am trying to use a FlashPro as3 widget and Captivate 6, to toggle an image on the Captivate stage (hide/show) and can't find enough information on how to access the stage objects.
I can use
var numKids:int = parent.parent.parent.numChildren()
to see the number of children (of the stage object?) , but can't seem to figure out how to hide or show the child objects (image, button or anything).
My image names in my Captivate Project are Img_Einstein1 and Img_Einstein2. They reside on a blank slide along with two buttons and another widget.
I have looked at Tristen's web site and found a lot of useful information, but I guess I am just not putting it all together. Because I am a contractor I can't use the Widget Factory or purchase outside widgets.
Any help will be greatly appreciated!On 6 you don't have shared actions yet. I don't understand the explanation with 20 and 10. There are several examples of toggle buttons on my blog. For showing/hiding here a simple one:
http://blog.lilybiri.com/blog-after-posterous-clickclick -
Accessing display objects via the stage var
I'm passing a stage reference to my class, but when I try to
access a movieclip on the stage I get an error.
this gives me an error:
var mc = targetStage.myMovieClip;
Thanks!var myClass = new MyClass (this.stage);
That would be the same thing, this.stage would refer to the
Stage instance. Each .swf has one Stage instance. In a Flash
project, the stage has one child, the MainTimeline instance.
MainTimeline is basically a big MovieClip, and it contains all your
objects, scenes and timelines you create in Flash.
So, if you instantiate from the main timeline itself (either
on a frame script or Document class) you are already inside
MainTimeline, which is what you want to pass along a reference to,
so you would pass in "this" as Colin said, or "root".
Colin mentioned that MovieClip(root) would work anyway; if I
understand he is referring to the fact that every DisplayObject
(such as MovieClips and SimpleButtons created in Flash) already
have a "root" property that usually refers to the MainTimeline
instance. However, your class "MyClass" does not extend
DisplayObject so there is no root property available, which is why
you need to manually pass in a reference to the root
timeline. -
Can't access my files, the circle thing keeps going round and round
I can't access my files, the little cursor thing keeps going round and round, is there a way to by pass that or is my powerbook going dead
What version of OS X are you running?
Useful article here on the causes of the Spinning Beach Ball and how to troubleshoot it:
http://www.computerworld.com/s/article/9177479/Troubleshoot_the_spinning_beach_b all?taxonomyId=89&pageNumber=1
and also this:
http://www.thexlab.com/faqs/sbbod.html -
Accessing the stage variable problems in AS 3.0
Hi. Quick question...I'm trying to access the stage variable
which I believe is supposed to be global and I should be able to
access it from any class. Is this true? The compiler is complaining
that it doesn't recognize this variable? Note that these objects
have not been added to the stage yet but still, these are compile
time errors, so why is that I'm getting these errors?
Thanks,
SamSam,
> Actually, this doesn't have to do with that question.
> Basically, the compiler is complaining that it doesn't
> recognize the stage variable.
It complains about the DisplayObject.stage property? Are you
referencing it in conjunction with a DisplayObject instance?
> This is weird because in my AS 3.0 book, I see that
> the stage variable is being accessed without
instantiating
> it or retrieving it.
What book is that? I might have it, then I can see what
you're seeing.
> I am extending Sprite in all my classes.
Yeah, Sprite extends DisplayObject, by of InteractiveObject,
then
DisplayObjectContainer, so it certainly is entitled to the
stage property.
Let me know what book you're looking at, and if I don't have
it (and if
you're still interested), I'll try to recreate a simplified
proof of concept
on this end.
David Stiller
Adobe Community Expert
Dev blog,
http://www.quip.net/blog/
"Luck is the residue of good design." -
i don't want to do the recovery thing to my iPhone4, but my iPhone is at the stage in the update where it says to plug it into iTunes, is there some way to get out of this or save all of my data somehow?
What do you mean the "update" says plug it into iTunes? If you have the iTunes logo/USB cord on the screen, it's in recovery mode or needs to be activated. Anything that was on the phone is already gone. You have no choice but to plug it into the computer. Hopefully, you backed it up before you started the update.
If that's not what you mean, then please explain.
Apple may or may not be able to fix the lock button for you without replacing the phone entirely. You'll have to take it in and ask. -
Accessing display object on the stage from another class
I've googled this to no avail, I've only found how to manipulate the stage itself and not a display object on it, and I'm noob enough to not be able to figure it out from there. :/
I have a movie clip on the main timeline with instance name displayName. I created a button that should change what frame displayName goes to (in order to...did you guess it?! diplay the Name of the button. Awesome. )
So I am trying to write the code in a reusable fashion and have the buttons all linked to a class called GeoPuzzle. Inside GeoPuzzle I instantiate a touch event and run the code. However, the function has to be able to change displayName in the main part of the timeline and, of course, the compiler says displayName doesn't exist because I'm in a class and I'm talking about the stage.
Here is the simplified code in the class:
package com.freerangeeggheads.puzzleography {
import flash.display.MovieClip;
import flash.events.TouchEvent;
public class GeoPuzzle extends MovieClip {
//declare variables
public function setInitial (abbrev:String, fullName:String, isLocked:Boolean):void {
//set parameters
this.addEventListener(TouchEvent.TOUCH_BEGIN, geoTouchBeginHandler);
public function GeoPuzzle (): void {
public function geoTouchBeginHandler (e:TouchEvent): void {
e.target.addEventListener(TouchEvent.TOUCH_END, geoTouchEndHandler);
//some other methods
nameDisplay.gotoAndStop(e.target.abbrev);
public function geoTouchEndHandler (e:TouchEvent): void {
//some other methods
nameDisplay.gotoAndStop("USA");
The lines in bold are my problem. Now this code doesn't actually execute as is so if you see an error in it, yeah, I have no idea what the problem is, but it DID execute before and these lines still gave me trouble so I'm trying to troubleshoot on multiple fronts.
How can I tell displayName to change it's current frame from within display object class?
Thanks!if displayName is a GeoPuzzle instance, use:
package com.freerangeeggheads.puzzleography {
import flash.display.MovieClip;
import flash.events.TouchEvent;
public class GeoPuzzle extends MovieClip {
//declare variables
public function setInitial (abbrev:String, fullName:String, isLocked:Boolean):void {
//set parameters
this.addEventListener(TouchEvent.TOUCH_BEGIN, geoTouchBeginHandler);
public function GeoPuzzle (): void {
public function geoTouchBeginHandler (e:TouchEvent): void {
e.target.addEventListener(TouchEvent.TOUCH_END, geoTouchEndHandler);
//some other methods
this.gotoAndStop(this.abbrev);
public function geoTouchEndHandler (e:TouchEvent): void {
//some other methods
this.gotoAndStop("USA"); -
Is there such a thing as "the easy way to access my Time Capsule"??
Ok I'm totally new to Mac and I feel totally daft! I can't seem to figure out how to access my TimeCapsule from wherever I am in the world..... I read guides, I look at the manual but I am still totally lost! Can sameone please walk me through this, step by step, in a EASY way??
Don't feel daft.. the fundamental principle of access from external location is a bit strange..
But there are lots of posts about it.. look up remote access time capsule.
Before I can give you simple info on how to set this up. I need some info..
Does the TC get the public IP on the wan interface?
For this to work in the simplest way.. the TC must be the only router in the network and handling WAN to LAN of your network.
Once you do that. Find out the public IP of the TC.. you will see that on any site that reveals your public ip but it should also be available in the TC.
In the setup of the TC via airport utility go to manual setup disk file sharing.. and check for wan access and give the TC disk a password.
In the Mac you carry around.. from a real internet connection not the one your TC is connected to,
Open finder.. top menu.. go, go to server.
Type in AFP://ipaddressofTC
You will then be asked for password which you will have to give..
Tell us the info and if it worked. -
Adding objects to the stage & acceessing stage properties - I'm a bit confused..
Hi,
I'm a little confused on two fronts regarding display
programming:
A. What the best way to add objects to the stage?
B. How to access stage properties.
I can do both of these when the project is an 'Action Script
Project', but I'm having trouble when it is a 'Flex Project' (e.g.
an MXML file). See the two attached files with questions included
in the comment to see exactly what I mean.
A. What the best way to add objects to the stage?
=====================================
In an action script project that extends Sprite I can just
call addChild()
In an MXML project I can add objects to the stage by first
adding them to a UIComponent, then adding that to the stage.
1. Is that the best way to do it?
In this doc:
http://livedocs.adobe.com/flex/3/html/help.html?content=05_Display_Programming_02.html
it says that
quote:
Each SWF file has an associated ActionScript class, known as
the main class of the SWF file. When Flash Player opens a SWF file
in an HTML page, Flash Player calls the constructor function for
that class and the instance that is created (which is always a type
of display object) is added as a child of the Stage object. The
main class of a SWF file always extends the Sprite class
2. why cant I just add a sprite object direct to the stage
without the UIComponent?
3. What is the 'main class', and how can i get access to it?
B. How to access stage properties.
=========================
In an action script project that extends Sprite I can just
call trace(stage.framerate)
But in an MXML file I cannot figure out how to access the
stage properties.
See the attached code for the things that I tried, but which
didnt work.
In the page:
http://www.actionscript.org/forums/showthread.php3?t=140655
It says
quote:
For stage access you have a couple of rules:
* natively, only display objects have inherent access to
stage
* display objects only have a valid reference to stage if
they're within the stage's display list (on the screen, after added
to it with addChild)
* The only display objects which immediately have access to
the stage before the use of addChild (in their constructor) are the
document/application class instance (root) and any instance from
the library placed on the timeline (not created with AS).
* Non-display object classes have to be passed or assigned a
reference to the stage from another object which already has access
to it - they cannot access it otherwise.
4. How do I access the stage properties in the MXML project?
5. I suspect this is related to the "main class", which I
dont yet understand - is it?
Sorry for the long post.
cheers
tom"tom saffell" <[email protected]> wrote in
message
news:gd7cm9$d1v$[email protected]..
> Thanks Luigi - that helps a lot.
> I hadnt seen the Flex 3 Developer Guide before - it's
very useful.
>
> I now see that I can access properties of the
application object directly
> with
> this.<property>.
> However, the framerate property cannot be set by
actionscript, only in
> MXML (I
> can set it in the <mx:application> tag). But I
need to be able to set it
> programatically, dependent on user input.
>
> 5. Is there a way around this?
> 6. Can I set the stage's framerate to achieve the same
outcome?
>
> I still dont understand why I cannot access the stage
object. When I call
> either
this.stage or
uic.stage * then I get
quote:
Cannot access
> a
> property or method of a null object reference.
My understanding is
> that I
> can access the stage object via any display object on
the display list.
> I'm
> confused about this bit..
>
> * - uic is a UIComponent that has been added to the
display list (i think)
> by
> calling addChild(uic) from the AS3 within the
application
>
> 7. How do I access stage properties in AS3 in an MXML
project?
http://www.adobe.com/livedocs/flex/3/html/help.html?content=05_Display_Programming_10.html
It seems like possibly your real problem is that you're
having trouble
searching the Help effectively:
http://flexdiary.blogspot.com/2008/07/getting-help-in-flex-builder.html -
Error when I put a component in the stage and I change any property
Hello
I'm using Flash CS4, as3 and adobe air file. I have an application with 3 scenes, first scene to login, second to set up, and third to see an video.
The problem is that, when I put a component in the second or third scene, if a change any property in the component inspector, any property it gives me error. So put the component and I change property by code in as3.
But I'm doing things with FLVPlayback component, and now before enter the scene gives me error, the solution will be to get the original properties, but I don't remember, I could install other time Flash CS4, but I can do that for any componet, better know the solution.
For example, I have an as file who is the class named p.e. MyMainclass, and in the scene3, I put FLVPlayback, who default values it's the last I used (I don't remember default after instalation), if any code in as3, it gives me this error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.program::MyMainClass/__setProp___id2__scene3_myvideo1_1()[com.program.MyMainClass::__ setProp___id2__scene3_myvideo1_1:7]
I remove this component, I put another one I never used, it doesn't give me error, I change any property in the object inspector, p.e. color, it gives me error, I change to original property again, and then NO ERROR.
Thanks in advanceI would reccomend that you not use scenes for that purpose, not exactly sure why but scenes are unreliable. Try putting all of your content in one scene, one timeline and just add a few stop() 's at the end of each "scene", then in your code remove scene2 and scene3 three references, and you'll possibly need to change frame anchors/targets also if you have them.
The error indctates that you have called an object that does not exist at the time the code is run, check where you placed your code, should be frame one, scene1, and also check if you have objects entering the stage down the timeline, that do not enter in frame 1, possibly the movieClip? if so add another keyframe on your actions layer on the same frame as the object and enter the call function for it there. -
Movie Clips vs the Stage help me out plz
Before i start i currently am taking a class on flash and i
dont think we have gone terribly in depth.
I have 2 sets of Code one in a Movie Clip and another on the
Stage.
the issue i have is neither one can see variables from the
other. is there some special syntax or notation i need to pass the
variables
I cant see the Current Unit in the ButtonSyntactically your code is just fine. I didn’t receive
any errors when I checked it. However I would rearrange some things
in it. The 2 eventhandlers in the onEnterFrame function, I would
pull these out and put them outside of the onEnterFrame function
but on the same frame.
“the issue i have is neither one can see variables from
the other. is there some special syntax or notation i need to pass
the variables”
Inside that mc, the code that you have below “//Code in
Button”, it is typically recommended that you don’t
reference other movieclips by using ‘_levelX’. Use a
relative path, such as ‘this._parent” or
“this._parent._parent” depending on how many movieclips
are nested into it. Also note, when you reference a movieclip from
inside an eventHandler (onPress, onRelease, onEnterFrame, etc.) you
are already within an object. So to reference something on the same
tier you should use ‘this._parent’. Once you find the
correct tier by using the code I mentioned in the last sentence,
you then need to attach the instance name of the movieclip you are
trying to access (that is if you are trying to access a movieclip).
For an example, ‘this._parent.currentguy’.
I hope this helps, I understand it may be hard to grasp
however give it a shot and post back.
You may be interested in this link that is from the livedocs;
http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context= LiveDocs_Parts&file=00001220.html -
I deleted my desktop icon - now I can't save things to the desktop!
After a complete meltdown of my computer (and thank GOD I backed everything up!!) ... I'm transferring everything back to my iMac from an external drive ... BUT, I deleted the little "desktop" icon from my finder folder - or more like, I dragged a desktop folder from the external hard drive and "replaced" the desktop icon.
Now I can't save anything to the desktop. When I drag something to the desktop it says "The item cannot be moved because the 'desktop' cannot be modified."
Is there a way to get this back???No ...
Under "Ownership & Permission" is says "You can - Read & Write", so that's not the issue.
What I did was:
When you open the finder window, there are several icons that appear in the window - usually the Desktop icon, the Home icon, the Applications icon, the Documents icon, the Movies icon, the Music icon and the Pictures icon.
What I did was, I dragged a "Desktop FOLDER" over from an external hard drive and it asked me if I wanted to replace the Desktop. I said "Yes" and now I no longer have the DESKTOP ICON on the left side of the finder window and I can no longer drag and drop things to the desktop.
The desktop icon no longer exists, so I can't access my desktop VIA the finder window.
Does this make sense? -
This is a strange one... I just recently did a complete format/reinstall of Lion because of very poor performance after upgrading.
So I'm on a totally fresh system, no TimeMachine restore or anything. I've installed all my apps from scratch - no prefrence file backups or anything. Everything is fresh.
Yesterday I tried to copy a file from one folder to another and I got the error "The operation can’t be completed because you don’t have permission to access some of the items". Checked file permissions... repaired disk permissions... made sure I was logged in as admin (I only have one account)... everything looks good.
This is now happening when trying to copy any files anywhere on my machine... Very frustrating.
There's a couple strange side-effects I've noticed:
- I can move & copy files just fine in terminal... without sudo...
- The little lock icon in the bottom right of the Get Info window doesn't do anything - I can't unlock it. I can still edit the permissions for the file/folder but I can't select the "apply to enclosed items..." option.
Does anybody know what the heck is going on?jsd2 wrote:
Try creating a new admin user account, logging into it, and then creating some new items on the Desktop and elsewhere. Does the same thing happen there?
Ok the strangeness continues!
I created a new "TestAdmin" account, but it doesn't show up in the Users & Groups prefrences sidebar... The /Users/testadmin folder was created, but the account doesn't show up in the prefrences or login window...
I tried a reboot to see if the account would show up and it still doesnt.... However after the reboot I am now able to copy files again!
I'm paranoid that the problem will show up again since I have no idea what fixed it. I tried rebooting previously after repairing permissions which didn't solve the issue so it's not like I haven't rebooted since it started.
And now I have the issue of not being able to create user accounts.
A little dissapointed with Lion to be honest... the new features are cool but there are so many little bugs it really feels half-baked.
Maybe you are looking for
-
If i get Creative cloud, does this mean i always have latest version of lightroom?
Fed up of having to get new versions when I upgrade my camera, went from lightroom 3 when I had my Nikon D300 to lightroom 4 to use my D800. Now my D750 needs version 5! Will creative cloud stay up to date?
-
Ssl connection in Sony Ericsson.
Dear friends, My application connect the server using ssl protocol in SecureConnection. I am facing connectivity problem only in sony ericsson c902, t280i and k530i devices.. Can any one guide me to solve this problem. Thanks in advance, Regards, Hit
-
Adobe wants to spy on me - where do I stop them?
Ok, so I see with the latest version of Cash Cow that Adobe stated it would monitor my usage in detail and report back to them. Well, specifically they required me to agree to their spying. (In tiny print in loooong legal script that couldn't even be
-
Is it possible to use one respository between iPhoto and Picasa?
Quick background: I have ~1k photos sitting on a file server on my LAN. Currently there is a Windows machine with Picasa using the file server as it's library (for both adding new photos and editting). I recently purchased a Mac Mimi and was hoping t
-
How are the Basis Config Steps involved in sending an SMS through Workflows
Hi Every one, WE are implementing sending SMS's through workflows what are the various Configs that need to be maintained.. Regards, Raj