ActionScript 3.0 :: Positions Of Child Objects Oddity?

Sep 12, 2011

in short, i have object A, a container. Within this is object B (a child object) which has some x and Y offset that I input.I need to know the offset of object B, because i want to place other objects at the same onscreen position as B, but on the same level of the heirarchy as object A My problem though, is that B's offset from A isn't changing when i would expect it to - when the parent object is scaled. I set B's x offset to 200 pixels, and no matter how much i scale up or down the parent object, B remains in the same visual position relative to it. And B's x property is still 200, regardless of parent scale.This information is not meaningful to me, because i know that B's actual offset position from A is more or less than 200 onscreen pixels. I need to be able to figure out exactly what it actually is.

View 2 Replies


Similar Posts:


ActionScript 2.0 :: Placing Objects To Predefined Positions?

Jul 26, 2011

I am trying to create a script that spawns cubes with one second (30 frames) delay, then places it into one of the 10 predefined positions.

spawnTimer = 0
function onEnterFrame()
{

[code].....

View 5 Replies

ActionScript 3.0 :: Randomly Place Objects (by Four Different X-axis Positions)?

Feb 21, 2011

I am trying to figure out how to randomly place four cards on stage through external AS3, by arrays.For example:

Code:
var positionArray:Array = ["48.50", "125.50", "202.50", "280.50"];
function getXAxis():String

[code]......

View 0 Replies

Professional :: Browser Resize Of Flash Movie Mis-positions Objects?

Feb 16, 2011

IE 8 Flash CS4 v10 Windows XP Home SP3 (NOTE: The word "Resize" refers to an HTML change of the movie size;  it does not refer to a Window resize)
  
Objective: Display a transparent 800x600 flash movie in IE, stretching movie to 100% width and height of webpage but keeping the objects within the movie from getting re-scaled.  Objects are re-positioned at runtime via ActionScript with values meant to be relative to stage dimensions.
 
Problem: The movie resize is messing up the object re-positioning.  The movie is indeed stretching to 100% of the width & height of the browser window's client area, but the objects are repositioned relative to something else (perhaps screen dimensions, but not sure). Result: Objects which were programatically positioned relative to original stage size are spaced way too far apart in IE, in some cases off the screen entirely, though they were not like this in the Flash editor.Question(s): Why are objects which were positioned within the original stage dimensions being kicked off the browser screen while the movie itself remains entirely on-screen even after resize?  What dimensions/values are guiding the automatic post-resize repositioning of the objects? (These proportions appear to be different from the change in proportions of the movie itself.)

View 1 Replies

Actionscript 3 :: Movieclip - Change Positions Of Objects On The Stage By Click?

Oct 31, 2011

I have somme mc's on the stage an I want thatto change on mc with antoher by clicking on them. For example if I click on mc1 and than on mc2 than they schould change the positions.

View 1 Replies

Flex :: SWFLoader - Child Apps Couldn't Access Certain Objects That Were Instantiated By Another Child App?

Aug 23, 2010

i have problem with swfLoader in flex, when i close following code in click method i can easly add many swf to main application

<mx:VBox id="content" width="100%" height="100%" ></mx:VBox>
public function doIT():void
{[code]....

when i close adding those swfs in loop i have the same error, it looks like child apps couldn't access certain objects that were instantiated by another child app, so what can i do?

View 1 Replies

ActionScript 1/2 :: Attach Two Objects (movieclips) With Different Width And Height Properties Into The Stage, With Random Positions

Aug 27, 2009

how to attach two objects (movieclips), with different width and height properties into the stage, with random positions,without visual colliding.

View 6 Replies

ActionScript 2.0 :: Why Emptymovieclip Positions Affect Positions Of Thumbnails

Jan 22, 2007

I have thumbs placed on the stage. I create an empty mc to load swf. But my thumbs disappear from the stage when I test the movie ( html or swf) if I settle the _ and _y position of the empty mc.why the emptymovieclip positions affect the positions of my thumbnails?

View 2 Replies

ActionScript 2.0 :: HitTest/Shapeflag Oddity?

Aug 30, 2010

I'm a newb. I have a problem with a file I'm working on. HitTest with shapeflag works properly in a movie clip, but NOT in the main timeline. When I switch it to a simple HitTest with 2 objects and no shapeflag it still works.

I've attached the .fla. In this example you adjust the sliders to highlight different biomes. Everything works in when I TestScene the movie clip, but when I testMovie the whole thing the only hitTest that seems to be functioning is the one for Tropical Rainforest which DOESN'T have Shapeflag.

View 7 Replies

ActionScript 2.0 :: Oddity In Xml - 'undefined' Message

Jun 16, 2010

Using a script for an mp3 player. Desktop testing, movie shows 'undefined' message. I use the original xml file and all is well. I replace one of the defined urls in the original xml with one of my own - undefined shows up. I've checked syntax, typos - none. I've checked my mp3 links - show up fine online.

[Code]....

View 2 Replies

ActionScript 3.0 :: HitTestPoint Oddity; Doesn't Work Until Next Frame

Nov 23, 2009

If I move a display object and use hitTestPoint afterward on the same frame against a point within the object's new shape bounds, I get false no matter what. On the following frame I get true like I should. If I then move the object away and in the same frame hitTestPoint against a point which is NO LONGER in the current shape (since it moved) but WAS in the shape on the previous frame, I sometimes get true and sometimes get false. This seems totally screwed up. Am I going mad? I've tried the move and hitTestPoint in both mouse handles and enterFrame handlers, but enterFrame handler is the only one I really care about at the moment.

Check out the following code; click to define a new position for the large object, then in the next entetFrame event it will move it and perform hitTestPoint -- object turns orange when hitTestPoint is true. You should see the same weird behavior described above.

ActionScript Code:
var circ:Shape = new Shape();
circ.graphics.beginFill(0x009900);
circ.graphics.drawCircle(0, 0, 30);

[code]....

View 2 Replies

ActionScript 3.0 :: Only Target Certain Child Objects?

Jul 31, 2009

I want to set the scaleX and scaleY of certain child objects within a movieclip, but there are tons of other elements inside of it. Here's what I have so far:

for (var i:uint = 0; i < outer_mc.numChildren; i++) {
trace(' | ' +i+'. name:' + timeline_mc.getChildAt(i).name);
}

This returns 60 child objects. The 50 I want to scale down have "_mc" appended to their instance name. I figure I should make a new array or variable and set the scale of those to whatever I want.

View 4 Replies

ActionScript 3.0 :: Listeners In Child Objects?

May 1, 2010

Say my flash project has an object A. In object A is an event and it's corresponding listener B. How do I get listener and event B to function in my flash project? I remember it something to do about "focus", right? Or am I completely off target, ha?

View 4 Replies

ActionScript 3.0 :: ScrollPane - Clip Child Objects?

Feb 12, 2010

Is there a way to dynamicially add graphics objects to a display list that a backbound JPG image sits in, and have ScrollPane automaticially manage scroll and clip for the entire set of objects (the base JPG and 3 dynamicially created graphics objects?? I create a ScrollPane (myScroll) and give it a source .jpg file. Then I create some graphics objects (myRec) and add them as children of myscoll,

[Code]...

View 7 Replies

Professional :: Child BaseClass Objects Cannot Share Same Name

Jul 3, 2010

On stage I have 2 objects on stage that share the base-class of "ABaseClass". Each has a child object that shares the base-class of "AnotherBaseClass". They child objects do not share the same parent, and have unique Linkage identifiers of "Object2Design" and "Object1Design", so they should be able to share the same name on the display-list, right? But if these child objects share the same name I get the following error. How to allow child objects to share base-classes and names?

TypeError: Error #1034: Type Coercion failed: cannot convert Object2Design@256cfe81 to Object1Design.
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at AnotherBaseClass()
at Object2()
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
Example: [URL]

View 1 Replies

ActionScript 3.0 :: Remove Multiple Child Objects?

Mar 31, 2011

On my flash application I am using the Google map API this creates a child object I have removed this on every other page with [code]...

View 8 Replies

ActionScript 3.0 :: Removing Listeners In Child Objects?

May 1, 2010

I'm moving two objects accross the stage at different rates using the same function:

Code:
function moveClip(clip,speed){
clip.addEventListener(Event.ENTER_FRAME,moveIt);
function moveIt(event:Event) {

[Code]....

In AS2 I'd just use dot notation as above and it would work from anywhere or perhaps _root.red....

I've tried root. stage. childbyname Not sure where to from here.

View 2 Replies

ActionScript 3.0 :: Extending SimpleButton So Can Access Its Child Objects?

Jul 3, 2009

i have a simple navigation system with three buttons, each button have a text field in it. On mouse over they change color to blue. I can achieve all these without a single line of code. I simply make a button of my text field in flash, and change the color of the text in the timeline.
 
My problem occurs when i want to make the color to stay blue when i click on the button. Apparently you can't access the child within a button, in my case a dynamic text field.  I've googled this problem and they all say that you should use a MC instead of a button. Thats exactly what i have done so far. But i'm getting tired of writing a bunch of eventlisteners and put an extra layer with an invisible button in my button mc so i can get the hand cursor (because the .buttonMode  = true and useHandCursor doesn't work when there is text field inside the mc). Any way, shouldn't there be a more elegant way to solve this problem?
 
I've been trying to build a new base class for my button that extends SimpleButton, and from there access the embedded  child object, but the problem remains.
 
In this example i'm trying to simply change the text of the text field inside of my new MyButton instance. But i get the same old Error #1009: Cannot access a property or method of a null object reference.
 
package
{
import...
public class Mybutton extends SimpleButton

[Code].....

View 6 Replies

Flex :: Null Cast Between Parent And Child Objects?

Mar 1, 2011

I have a flex application with two objects: a parent widget (called an IBaseWidget) and a child widget (called a HelperWidget2).When the user clicks on a help link, a helper widget is loaded into the list of base widgets and then displayed for the user.However, when I try to access this child widget by casting the base widget in the collection to the child widget type,the child widget returns null and I am unable to work with the widget.The following snippet correctly returns the widget ID of the newly added widget and dispatches an event to load the widget:

var id:Number = WidgetManager.getInstance().getWidgetId("Helper");
ViewerContainer.dispatchEvent(new AppEvent(AppEvent.WIDGET_RUN, id, openQuickQueryCanvas));[code].........

The problem is that helperWidget above always returns null, meaning the cast isn't successful.

View 1 Replies

ActionScript 3.0 :: Display Objects Parent Child Relationship?

Sep 22, 2009

Confused over actionscript children. Reading a book on this shows the following code:

var firstContainer:Sprite = new Sprite();
var secondContainer:Sprite = new Sprite();
secondContainer.addChild(firstContainer);

[code]......

View 6 Replies

Flash :: Get The MouseEvent.localX And LocalY Of A Target But Not Its Child Objects?

Jul 24, 2009

I'm creating a simple drawing application that adds new Shape objects to a MovieClip "canvas" every time the user clicks and drags. The problem is, I'm noticing that even though the MouseEvent listeners are set to the MovieClip, the child Shape objects are being returned as targets as well. This disrupts the localX and localY as well, causing the drawing cursor to jump around as the coordinates change from being local to the entire MovieClip to local to the Shape the mouse is currently over.Is there any way to retrieve the most parental target from a MouseEvent?

View 1 Replies

Actionscript 3 :: Testing For Undefined And Null Child Objects In Flex?

May 20, 2010

I use this pattern to test for undefined and null values in ActionScript/Flex :

if(obj) {
execute()
}

Unfortunately, a ReferenceError is always thrown when I use the pattern to test for child objects :

if(obj.child) {
execute()
}

ReferenceError: Error #1069: Property child not found on obj and there is no default value.Why does testing for child objects with if statements throw a ReferenceError?

View 3 Replies

Flash :: Possible To Have Different Line Scalemode Options For Parent And Child Display Objects?

Sep 1, 2011

Imagine situation when child component is scaled and parent component is scaled as well. I want line to be drawn without scaling in child component and to be scaled in parent. Is it possible to achieve this?

View 1 Replies

ActionScript 3.0 :: Unable To Reference Child Display Objects Of Clip Imported From Library?

Jun 17, 2009

PBar contains two SimpleButtons (pBarProgress and pBarLoaded) and a MovieClip (pBarBg).I import pBar from the library like this:private var pBar:PBar = new PBar();and add it to a container MC on the stage like this:containerMC.addChild(pBar);Up to this point, everything works great. I can see pBar and its children on the stage when I run my movie. But then I want to start referencing and manipulating pBar's child objects, but nothing I do works. Ive tried ...pBar.pBarProgress.scaleX = 0;var pBarProgress:SimpleButton = Bar.getChildByName("pBarProgress") as SimpleButton; pBarProgress.scaleX

View 1 Replies

ActionScript 3.0 :: Multiple Buttons To Open Child Swfs Then Be Able To Close The Child From Within The Child?

Mar 25, 2009

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 Replies

ActionScript 3.0 :: Enlarging Movieclips Without Enlarging Child Objects?

Mar 6, 2011

I am adding buttons to a rectangle movieclip with actionscript. With every addition I am increasing the height of the rectangle to accommodate the new button. I use recMovieClip.height += 20; This increases the height of the movieclip but it also increases the size of the buttons which are children of the movieclip.

View 2 Replies

ActionScript 3.0 :: Add Duplicates At Different Y Positions?

Oct 9, 2009

I have a movieclip in the library that I am exporting for actionscript.  I duplicate the movieclip by adding a child for each occurance of a tag in actionscript.  This works fine, but I can't figure out how to change the y postion of each new child to be 30 pixels below form the last child.  Here is a snippet of the code where I am having the problem:
 
for (var i in xmlData.region){        for (var k in xmlData.region[i].regionInfo.payment);
            var mcRI:regionInfo = new regionInfo();            this.addChild(mcRI);            mcRI.txtPayment.htmlText = xmlData.region[i].regionInfo.payment[k].card;            mcRI.y += 30;        }
}
 
Instead of each new child's y position changing +30, every duplicate is on top of each other at +30.

View 3 Replies

IDE :: Flash 8 Moviclip X+Y Positions

Aug 11, 2009

What I'm really looking to be able to do, is have a clip in the root move to the same x and y as a clip that is embedded into another movieclip. How would I pick up the X and Y co-ordinates of this embedded movie clip?

To summarise,

ClipA is embedded into ClipB, what I want, is for ClipC - that is based in the root - to match ClipA's position.

View 2 Replies

ActionScript 2.0 :: Positions Of MC (x And Y Co-ordinates)

Jul 20, 2010

I have 52 (pack of cards) movieclips on stage all turned invisible When selected they turn visible. and need to display in one of five set positions (e.g. x and Y co-ordinates). If the first slot if full the card should be displayed in slot two. IF slot two is full the next dard displays in slolt three. I card two is then removed and a space left the next card chosen should go in there.

View 3 Replies

ActionScript 2.0 :: Swf Refers To Positions Of MC's In Itself?

Aug 14, 2004

ok I am having what I think is a targeting problem.I'm loading a swf into a blank container inside another movie (main). The AS in the loaded swf refers to positions of MC's in itself _x & _y etc.However once it is loaded, those positions are not true... ex. if the center of the swf is 200 by itself depending in where it is loaded, it might become 400 or any other number - reletive to the main movie's stage (I hope Im being clear).I need the AS in the loaded swf to refer to itself (x/y values relative to its OWN stage). So how do I target that? _root.MC.containerMC doesnt seem to work, but is this on the right track? Basically when an swf is loaded into another, does its _root now become the main timeline of the movie its loaded into???

View 2 Replies







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