ActionScript 2.0 :: _root X,Y For Child Object?
Jun 14, 2006My question today is relatively simple: is there a way to return the X, Y values of an object but pretend that it is on the main stage, not within a separate movie clip?
View 4 RepliesMy question today is relatively simple: is there a way to return the X, Y values of an object but pretend that it is on the main stage, not within a separate movie clip?
View 4 RepliesIn the code below i want to change the _root.broj and _root.logo variables inside the function which returns values from .php file. Inside the function everything works fine and all values are correct but when i trace var broj outside the function it's still 0.
var result_lv:LoadVars = new LoadVars();
var send_lv:LoadVars = new LoadVars();
var broj:Number=0;
var logo = new Array();
[Code].....
im lookin to make this so that the points taken from the _root.cargo are multipled by 10 and added to _root.totalscore
[Code]...
I have an Movie Clip in Flash that have subobject of button type which has subobject of input text and movie clips. Right after creation core Moveclip all subobject are set to null, when I expect them to be valid objects.
[Code]...
MC_Core_design was created in Flash and exported to Actionscript. I've done this for button_1 class aswell. The code was written using Flex. When I comment out both lines that result in error I get correct view of the core Movie clip with all subobject. How can I set subobject properties right after object creation?
if a condition is true, then:_root.(MC with instance name that is the value of "_root.eelmine").nextFrame(); is this correct?_root._root[eelmine].nextFrame();
View 16 RepliesI just recently began migrating from AS2 to AS3, and I have of course realized that I can no longer move the "_root" by changing the _x and _y positions of the _root (which no longer exists in AS3). How can I do this in AS3 (specifying _x, _y, _z possibly of the "_root")?
View 2 RepliesI want to listen for a custom event dispatched from the document class in a custom subclass. For example, let's say in the document class I have:
ActionScript Code:[code]....
So that the subclass will trace 'Event from document class received' when the 'customEvent' event from the document class is listened by the eventlistener. However, the output is only 'customEvent dispatched', meaning it wasn't heard in the subclass.
I have a picture on the stage that has multiple items that have hotspots/links over them that should open a child swf on top of the background and show details about the items. then have a button in the child swf itself that removes the child from over the background so the user can click on another item etc.I found this code in someone's post and I am trying to modify it so that works for multiple swf files...it currently works for a single swf.I wan to pass the name of the button in front of the .swf in the URLRequest to have the same name as the instance name of the referring button. But I can't figure it out. Here is the code I am using on the stage
View 2 RepliesHow do I reference the xth movieclip child object within the nth movieclip object? _root["Object_"+n]["Child_Object_"+x] doesn't seem to work.
View 1 RepliesI have entered this code into the first frame of an empty movie that has a MovieClip object that was exported for actionscript. The addChild code works fine, but I am wondering how to add an event in the object that calls a function in the object which will be added to the main stage. In the same way as saying m.onEnterFrame = function {} from AS2
View 1 RepliesI have made an xml object and add few children to it. I use appendChild() to add a child to the XML. But if i want to remove one, what should i do? I tried to search in the reference but I cant find a remove function.
View 7 RepliesI'm exercising scripting and struggling with adding a child to a object when the creation of the child is wrapped in this function
function makeBox():void {var box:Shape = new Shape;box.graphics.beginFill(0x66FF00);box.graphics.lineStyle(5, 0x6600CC);box.graphics.drawRect(mouseX, mouseY, 50, 50);addChild(box);}
Now I want to add the above shape as a child to this object
var Clip:MovieClip = new MovieClip;addChild(Clip);
if the first code was not a finction I have no problem to add the child by Clip.addChild(box); but I cant figure out how to use it if it is as a function.
I have added an on click event to a child object which is not always displayed Its pearent object also has on click events. There are two problems.
1) Whenever I click on the child object the pearents onclick behavior also runs. I do not want this to happen.
2)The child object can be clicked on even if i set its alpha to 0, or set its display property to false or send it to the back of the stage. This means its behavior can be invoked by the user even if it is not visiable I dont want the child object to be clickable when it is not dispayedI dont want the pearent object to be clickable through the child object
Im using the following code to place an object inside a container:
testParent = new MovieClip();
testParent.graphics..beginFill(0x0000FF);
testParent.graphics.drawRect(50, 50, 300, 300);
[Code].....
this gives the testParent object a margin of 50 from top and left. The testChild object should have have the same margin relative to stage. But doesnt.. The child object is at 0,0 relative to stage. Whats causing this?...
Is it possible to get the child display object under the mouseX & Y coordinates when using hitTestPoint on it's parent?
I need to set a var as whatever target object is located under the mouse coordinates if the hitTestPoint equals true.
ActionScript Code:
if(parent_mc.hitTestPoint(stage.mouseX, stage.mouseY, true))
{
//var child = new var(child object under mouseX & Y);
}
This is the error I am getting....This is the situation I am using addChild and removeChild. I have two main movieclips that this is based around. workss_mc and work_mc. workss_mc is the slideshow, work_mc is the selection grid. When you click on an object in work_mc I am adding adding a child (workss_mc) and removing work_mc at the same time. That works fine; however, in workss_mc I have a back button, this back button is used to remove works_mc once it is removed it sends you back to work_mc. Once you are back on work_mc everything should work completely the same, however, it's like it's ignoring the code.Here is the code for the button:
Code:
urbanthmb_mc.addEventListener(MouseEvent.CLICK, clickHandler);
function clickHandler(event:Event) {
var workss_mc = new mc_workss();[code].......
I have a web site that creates a page by calling another class object. When I return from that page to the Main page I want the old page removed. I have done it like this but I am getting errors.
Two vars in GlobalVarsContainer:
public static var removePages:Boolean;
public static var pageToRemove:Object;
Create new page object:
function onClickBtn1():void {
var servicesHome:ServicesHome=new ServicesHome();
addChild(servicesHome);
}
[Code] .....
This is the error:
ReferenceError: Error #1065: Variable servicesHome is not defined.
So I know it's getting back here with all vars set correctly. I've tried changing the public static var pageToRemove:Object; to a string but that is not right.
I have written this little script, as i want to remove some of the text fields that are currently contained within the Display Objec, however it does not like to see the TextField as a varaible name. How would i convert the object from an array to become a textfield that can be removed, after being added through
addChild()
This is the script
var delayHeading:Number = 1500;var repeatHeading:int = 1;var setShow:Timer = new Timer(delayHeading, repeatHeading);setShow.start();setShow.addEventListener(TimerEvent.TIMER_COMPLETE, maybeLater);
[Code].....
If I import pgming from one AS into an overall one like this:
import asFiles.slideshow.*;
public var slideshowAS:Slideshow;
//then later:
[code]...
how do I control one object that is within that child .as file from the parent .as file?so for instance if in the slideshowAS there is an item called "nextBtn" and I want to be able to do something with it in the parent main menu .as file.
The following code is not working
function menuAct(event:MouseEvent):void { event.currentTarget.parent.removeEventListener(MouseEvent.MOUSE_OVER,
[code].....
it's very simple thing i have a swf file try.swf, and it have little bit animation, I stop it's animation on timeline frame 1and i use this code... to load try.swf in other flash fileimport flash.display.Loaderimport flash.net.URLRequestvar ld:Loader=new Loader()var rq:URLRequest=new URLRequest("try.swf")ld.load(rq)addChild(ld)now i hv load try.swf in ld Loader now I want when this loaded then try.swf gotoAndPlay though frame 2 and start showing animation.
View 1 RepliesI have a menu MovieClip that has its buttons inside of it. I have the menu with a MousEvent.CLICK and trying to figure a way to register what you are clicking on.
[Code]...
Right now, I create the world class first, from my main timeline. This is placed as a display object, and it contains many other display objects, most notably the level Holder, which holds all foreground pieces.After creating the world class, I create the camera class from my main timeline, and pass it the instance of the world class as an argument. What I'm trying to do in the camera's code, is create DisplayObject variables for the levelholder (and several other children of world) and set it equal to world.lvlHolder, like so
Code:
public function Camera(input:DisplayObject)
{
[code].....
Is there a way to test collision with a child of an object?eg.
ActionScript Code:
obj1.hitTestObject(obj2.childObj1)
obj1 and obj2 are on the same level of hierarchy.
I am trying to test when an object collides with a particular location of another object so i made a 1x1 movieclip (childObj1) and placed it inside obj2 at that particular position.
Is there a way to keep an object above a child that is being added to the stage?
Say I have a frame on the stage and I want to add different children to the stage, but want those children to fall under the frame that is already on the stage?
I am programming a "build a tower" game. After removing the event listener from the first movieclip, flash won't add the event listener to the by as3 to the stage attached new movieclip.
[Code]....
If I import pgming from one AS into an overall one like this:
[Code]...
how do I control one object that is within that child .as file from the parent .as file? so for instance if in the slideshowAS there is an item called "nextBtn" and I want to be able to do something with it in the parent main menu .as file. If you could even direct me on what to search under I that would be very helpful! I tried googling it but did not know how to search for it.
i made thumbnails dynamically and i waana access it's child movieclip
var totalThumbs:Array=new Array()
var ThumbMC:MovieClip()
var childThumb:MovieClip()
[Code].....
I've got several objects on a stage, each is an instance of a different class. Inside each of those classes is a timer, set to loop (basically refresh) every 5 seconds.Even after removing the instance from the stage and setting it to null, the timers continue in the background. Is there some way I can stop and remove all the timers with an object when I null it, or do I have to do that manually before removing the object?
View 7 RepliesSo I have a MC called "slider" slider has multiple graphics and clips and buttons in it. I have an event handler that tells the "slider" clip to move when you rollover and to move back when you rollout. Problem is that anything you rollover in the parent clip, once rolled off, even thought it is still in the parent clip, it triggers the rollout action.
Code:
this.slider.addEventListener(MouseEvent.MOUSE_OVER, slideOvr);
this.slider.addEventListener(MouseEvent.MOUSE_OUT, slideOut);
[code].....