Actionscript 3 :: MouseX/Y Confusion When Dragging A Child Of A Container?

May 25, 2011

I've got a grid of images which are added to a imagecontainer(Sprite) in a class. When I click a button, the imagecontainer gets tweened(scaled) to 0.2 Now I would like to start dragging around the images. on mouse-down I add an enterFrame Event:

[Code]...

Unfortunately the image is never on the mouseposition but has a increasing/decreasing offset to the mouse pointer.The alternative, startDrag/stopDrag works perfectly, but I stll need the mouseX/mouseY for placing the image on a grid.I tried also parent.mouseX, no luck with that.Why is this happening? I thought mouseX/mouseY is always depending on the stage-dimension.

View 2 Replies


Similar Posts:


Professional :: Run Project (main Container SWF And Child SWFs) Into Another Container File Which Place On A Website?

Jun 17, 2010

I am facing a issue in Flash container. I am having a project which has main container which call different SWFs into it. Now I call this main container file into another container, and their problem starts. Many option doesn't work properly which generally have _root, _parent etc...
 
If I want to run project (main container SWF and child SWFs) into another container file which place on a website. I want to show whole project from this container file so what I need to do?

View 1 Replies

Flash :: Dragging Object From Html Page Into A Container?

May 12, 2010

I am doing some pre-production on a project that requires drawing on a 3d canvas, which I think flash is the best way to go. But there is a chance down the line that this client might want the site to show up on the ipad, iphone or other mobile devices that don't support flash.

So I was playing with the idea of doing everything in html and javascript except for the actual drawing/3D area. Almost like using flash as the element. I think html5 is too premature to start using this, but might be beneficial down the line. Chances are I will just go the entire flash route, but I thought it would be interesting to try. question is pretty top level. 1) how hard would it be to drag an object from an html page using javascript, and dropping it into the flashplayer. And then manipulating it from there.

Are there any examples out there that have tried to do this?

View 1 Replies

Flex :: Prevent Dragging Outside The Parent Container In Flash?

Nov 22, 2010

I have a canvas onto which I draw shapes like rectangle etc. When I move the shape using my custom mouse down/mouse move handler, the shape can go outside the parent bounds.

I am checking if the child is outside the parent's bound to snap it back:

var bounds:Rectangle = this.getBounds(this.parent);
var p:Point;
if (bounds.x <0) {

[Code]...

The snapInside method gets called when I go outside the left or top boundary. But when the child is dragged outside the right or bottom boundary, I find Flex/Flash runtime automatically expands the parent's height and width. So say the parent size was initially 800x600, if child Y bounds exceed 800 by say 20 pixel, I find the this.parent.height automatically resized by flex to 820!!

How do I prevent the parent from resizing when child goes outside the original bounds of the parent ?

View 1 Replies

Flex :: Drag - Change The Size Of Container With Mouse Dragging?

Dec 21, 2011

When you drag the edge of container with mouse ,how to implement changing the size of container?

View 1 Replies

ActionScript 3.0 :: Slider: Can't Remove Child And Dragging Occurs Outside MC?

Aug 16, 2009

I'm creating an AS3 slider where the idea is if the y axis of the slider reaches a certain area, the movie clip 'numbers' disappears and a trace statement is executed. However, that's not happening at all. Not to mention when I scroll the arrow movie clip outside of its' area, the movie clip continues to slide up and down even though it shouldn't. I've attached the .fla and the AS3 code is below.

import flash.display.Sprite;import flash.display.DisplayObject;import flash.events.MouseEvent;
var arrow_mc:MovieClip = new arrow();addChild(arrow_mc);arrow_mc.x = 110;arrow_mc.y = 316;

[code].....

View 7 Replies

Actionscript 3 :: Flash - The Supplied DisplayObject Must Be A Child Of The Caller When Dragging A Clip?

Feb 21, 2011

all I'm trying to do is set up dragging for my movie clips, but I keep getting this error:The supplied DisplayObject must be a child of the caller.This is my code:

projectThumb.addEventListener( MouseEvent.MOUSE_DOWN, onThumbPress );
projectThumb.addEventListener( MouseEvent.MOUSE_UP, onThumbRelease );
function onThumbPress( e:MouseEvent ):void

[code].....

View 2 Replies

Hide A Child Container Of A Viewstack?

Jun 29, 2010

I have a tabbar whose dataprovider is a viewstack and the viewstack contains a group of vbox containers. I am trying to hide one of the vboxes based on a certain condition but the tabbar still shows the corressponding tab for the hidden vbox. I set the visibilty and includeinlayout of the vbox to false but the tab still exists.

View 1 Replies

ActionScript 3.0 :: Call On A Specific Child In A Container?

Nov 4, 2010

I am loaded images into a container that is being displayed on a map.  I've created a string of my images names and am looping a loader to load each image and add them to the container.
 
var overlays=["compsmall.png","compsmall3.png","compsmall3.png","compsmall4.png"]
var overlay_container:MovieClip= new MovieClip();
function calloverlays():void

[Code]....
 
Once all of my images are loaded into the container overaly_container how can I call on a specific child of the container?  For example how can I call on compsmall2.png once its been loaded into overlay_container?
 
I place these images onto a map by placing the whole container at the correct location.  I then turn layers on/off by adding and removing the children within the container.  This is why I'd like to specify a specific object in the parent.

View 3 Replies

Actionscript 3 :: Targetting The Next Container Child In Flex?

Sep 27, 2011

i have created a couple of buttons at run time in flex. when i click on one button using event.currentTarget property i can change its properties like x,y,label etc , also i can get its index. Now i can found the next child index too but how can i change the properties of next child using its indexCurrently i am using getElementIndex(Button(event.currentTarget)).x for changing its x coordinates. Need to change the coordinates of the button next to it.

View 1 Replies

ActionScript 3.0 :: Set MouseEnabled=false For Each Child Of Container?

Jun 22, 2011

PHP Code:

container.mouseChildren=false;container.mouseEnabled=false; 

to set mouseEnabled=false for each child of container would not help performance right?

View 4 Replies

ActionScript 3.0 :: Accessing Child Properties Of Items In A Container?

Jun 8, 2011

Basically, I have a menu created using XML. Each menu item has a fill that fades in and out as the user scrolls over them. What I want to happen is that when an item is clicked, it stays highlighted. The problem comes when I click on the second item. I can't get the first item to "unselect."Here is the menu code and functions.

Code:
var menuHolder:MovieClip = new MovieClip();
menuHolder.x = myMask.x;

[code].....

View 6 Replies

Loaded Child Movie Controlling Container Parent

May 14, 2009

i'm a designer trying to step up my flash skills and have a scripting problem that's causing me trouble. essentially i have a child swf loaded into a container in a parent swf and want the child to be able to instruct the parent. to explain in full, the child contains an flv with bespoke video player components. it's container sits in one frame of the parent. when the flv finishes playing, i need the parent swf to move onto another frame.
as it's a controllable flv, it isnt possible to predict the exact length of time the child will need to be present, so it literally needs to tell the parent it's finished playing at that very point.

[Code]...

View 9 Replies

Flex :: Resizing A Container When Child's Visibility Is Changed?

May 28, 2010

When I set the visible property to false for a child in a container, how can I get the container to resize? In the example bellow, when clicking on "Toggle", "containerB" is hidden, but the main container's scrollable area is not resized. (I do not want to scroll through a lot of empty space.)

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[

[Code]....

View 2 Replies

Flash - How To Pass Variables From One Container MovieClip To Child

Nov 13, 2010

My question is not like the one I read because the context is different: Let's say instead of embedding a flash inside an html page with some flashvars, I want to embed it inside another flash or flex. How to set the flashvars in this case (using ActionScript 3)? So how to embed Flash in another flash and set same variables as it was embedded in html by passing querystring or flashvars.

View 1 Replies

Actionscript 3 :: Scaling A Container Does Not Affect Width Of Child

May 26, 2011

I've got a container(sprite) with children(sprites) added to it. When I scale the container, I would like to get the new width of a child, but when I trace the children's width I always get the original dimensions, even though everything gets visually scaled as it should. How do I overwrite the children-width ?

Update: I just found out that the children.graphics-"dimensions" could have caused the problem. When I leave the graphics, everything seems ok. Is it possible to scale the graphics at same time as the child-sprite?

View 3 Replies

Flash :: Separate Event Handling From A Container And It Child

Jan 2, 2012

I want to separate event handling from a container and it child. So as you can see, my source code is very simple :

[Code]...

View 2 Replies

ActionScript 3.0 :: 'Supplied Display Object Must Be A Child Of Container'

Nov 19, 2010

Basically I've got a class called Controller and another class called:"EnemyShip".In EnemyShip's step() event (the ENTER_FRAME event), I call myStage.removeChild(this);[code]myStage is a reference in the constructor of the EnemyShip.as class

View 2 Replies

ActionScript 1/2 :: Startdrag And HitTest Confusion?

Jan 11, 2011

I have a button that I want to drag and drop to another movieClip which will then stop playing. the button is dragging and dropping fine, but the hitTest isn't working I'm guessing because the button is a button, not a movieClip.     I am not clear on how to make a button movieClip in as2
 
This code is on the button frame 1 and works fine
on (press) {
startDrag("stopSign");
}
on (release) {

[Code]...

View 5 Replies

ActionScript 3.0 :: Ternary Operator - If Else Confusion

Jun 29, 2009

I tried to use ternary operator, but I got lost. This ofcourse isn't going to work
Code:
var fit:Boolean;
if(
if(!fit){
(targetRatio > destinationRatio) {
}else{
[Code] .....

View 1 Replies

Flex :: Forcing A Child Component To Resize Itself Larger Than Its Container?

Mar 29, 2010

I am creating a component that displays a variable amount of "gauges" (square tiles of content if you will), that is laid out like so:

<HDividedBox id="container">
<VBox id="myComponent">
<HBox id="header">

[code]...

View 1 Replies

ActionScript 3.0 :: Using GetChildAt With A Sprite Conatiner Is Removing A Child From The Container

Jan 9, 2010

I am trying to get an image object from one sprite container and adding it to another sprite container. But when I use GetChildAt for this, it will remove the object from the parent sprite and place it inside the other.

Code:
sprContainer1.addChildAt(sprContainer2.getChildAt( 1),0);

Problem is when I run this code sprContainer2.numChildren is getting reduced by 1, which seems that this code removes a child from sprcontainer2.

View 2 Replies

Flex :: Airxmail - SMTP And Crossdomain.xml Confusion

May 26, 2011

I've created a Flex app which uses Coltware's airxmail to send SMTP messages. It calls a locally-hosted SMTP server (hmailserver), which relays the email out as appropriate. When run within the Flash Builder environment, everything works as intended. I can also send email both locally and remotely from the SMTP server using telnet, so I know that it's not a problem with the server. When hosted on the email server box itself, outside of the GUI, the app fails to send email. I've created a crossdomain.xml file to allow this access, but I don't believe it's configured properly.

[Code]...

View 1 Replies

Actionscript 3.0 :: Confusion About Events, ENTER_FRAME And MouseEvents?

Aug 31, 2009

I'm trying to rework an example found in the AS3 PDF manual, to work without the initial mouse click, but I'm not sure what to do.

The example is as follows (found on page 304 if you have the PDF) - I have changed it to move instead of fade, but didn't change the name of the function:

[Code]...

View 4 Replies

Flex :: Limit The Size Of A Child Container With Percentage Width/height Of 100%?

Mar 11, 2011

How can I limit the size of a child container with percentage width/height of 100%?

Example:

<mx:HBox id="container" width="100%" height="100%">
<mx:HBox id="scrollContainer" width="100%" height="100%">
<!-- keep this content limited to the size of "container" -->

[Code]....

Apparently I can get the desired behavior if I change HBox to Canvas but I would still like to know how to accomplish this with a HBox and why it differs from Canvas.

View 3 Replies

ActionScript 3.0 :: "Move" Stage-instantiated Movieclip To A Child Container?

Nov 3, 2011

I have some movieclips that are instantiated on the stage. Is there any way to "copy and remove" those movieclips to a child class?[code]...

View 2 Replies

ActionScript 3.0 :: Multiplying MouseX Value?

May 13, 2011

I have this mc that responds to mouseX , only the mc is very short in frames, it's only 25 frames long. This way the mouseX is only the first 25 pixels of my stage, so it only responds to that. Is there any way I can multiply this value to, let's say, 20 times?

View 1 Replies

Flash :: MouseX Value Changes When Cursor Is Still

Feb 1, 2012

Here is my code:

public function update()
{
//making the character follow the mouse

[Code].....

mouseX isn't being changed by me (and can't be since it's read-only), there isn't any other code in this object since I've only just started with this project.

View 1 Replies

ActionScript 3.0 :: Get Touchpoints Aka MouseX?

Sep 20, 2011

Is it possible to find all touch points that are pressed down, and its x/y properties, like we can with mouseX and mouseY?

View 0 Replies

ActionScript 3.0 :: MouseX In A Class

Sep 10, 2009

[Code]...

if I want to use mouseX and mouseY in my class whats the most effective way to do this?
I know if I extend a class to Sprite for example I get this feature but could I get it with less... I know I could say this also and then I wouldnt need to extend Sprite but I dont know if this is a good idea....

[Code]...

View 3 Replies







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