ActionScript 3.0 :: Conversion Between Container Coordinates?

Nov 10, 2010

This is a mockup of my swf: It's just a menu and a sprite named scene (which is a container for obj1 and obj2 and it's child obj3).The obj1 and obj3 are draggable. While dragging them the MouseEvent.MOUSE_MOVE is fired and in it's event handler I'm updating a textfield with the object's coordinates relative to the scene object:

private function onMouseMove(e:MouseEvent):void {
myTextfield.text = "x:"+ objectBeingDragged.x + " y:" + objectBeingDragged.y;
}

When I move obj1 I have no problems because it's parent is scene and the coordinates I want are the coordinates relative to scene. But when I try to move.obj3 I'm getting the coordinates relative to it's parent (obj2) and I want the coordinates of obj3 relative to scene.I tried to convert the objectBeingDragged coordinates to global and then to local but I had no success...

private function onMouseMove(e:MouseEvent):void {
var localPoint:Point = new Point(objectBeingDragged.x, objectBeingDragged.y);
var globalPoint:Point = objectBeingDragged.localToGlobal(localPoint);[code].....

View 1 Replies


Similar Posts:


Flex :: How To Get Size / Coordinates Of Content Area Of Container Objects

Jul 21, 2010

How do I get the size of the content area of Container objects? One non generic solution is checking for styles I suppose but I am looking for some code that works generic for all standard flex Container objects. The controls are Flex 3

View 1 Replies

ActionScript 3.0 :: Conversion Utility That Uses Number Input Via Calculator Style Buttons To Generate Conversion

Mar 13, 2012

im trying to create a conversion utility that uses number input via calculator style buttons to generate conversion for the following distances:

-Miles to/from KM
-cm to/from mm
-binary to/from decimal

Now i was thinking of possibly having the options contained within an drop down and an input text field where the numbers are entered via the calculator buttons. The only thing im struggling with is how to perform the actual calculations on the different formats. Has anyone had to do anything similar in the past? Ive only found currency conversion examples and not sure how to apply that to these conversions.

View 8 Replies

Actionscript 3 :: Convert Global Coordinates To Local Coordinates Of A UIComplenent In Flex Project?

Dec 19, 2011

I was trying to convert global coordinates to local coordinates of a UIComplenent in my flex project using below code using below code

var gp:Point = new Point(e.stageX,e.stageY); //global point
var lp:Point = uic.globalToLocal(gp); //local point

uic is UIComponent in which I have subclass of Sprite for drawing something I have set the sprite's mouseEnabled and mouseChildren to false to not interrupt the mouse event. above code is within uic's mousemove event where I was tracing the gp and lp gp was giving correct value and suprisingly lp was giving negetive values. when I move the move to the top left corner of uic i expect lp to be 0,0 but it is giving the -width of of uic. I broke my head for hours and ended up finding an alternate by using offsets. Infact my original code was much simpler like this which was same issue

var lp:Point = new Point(e.localX,e.localY);

I am not sure what exactly is causing this problem. the workaround had lot of issues and it creating a mess in my rest of the algorithms.Just now I found even more interesting thing (which is actually weird). for some reason I went and create a new lp2

var lp2:Point = new Point(e.localX,e.localY);

now surprisingly it was giving correct values as expected and I went back and changed the code as

var gp:Point = new Point(e.stageX,e.stageY); //global point
var lp:Point = uic.globalToLocal(gp); //local point
var lp2:Point = new Point(e.localX,e.localY);
var lp2:Point = uic.globalToLocal(gp);

now it is expected to have all the lp, lp2 and lp3 variables to be same but weiredly lp two is giving wrong value and lp2 and lp3 were giving correct. I am suspecting using the variable lp has something to do. I am not sure about that but above proves it so right now I am using lp2.

View 1 Replies

ActionScript 2.0 :: Converts 3d Coordinates To 2d Coordinates - Difference Between MoveTo And LineTo?

May 21, 2007

I was reading the 'Isometric Transformations' tutorial by Danko Kozar and I have a few questions. I understand what all the code does, but not how it does it. First of all, how does the following code work:

transforms x,y,z coordinates into Flash x coordinate
xFla = function (x, y, z) {
// cartesian coordinates[code].....

I understand that it converts 3d coordinates to 2d coordinates, but I don't understand how. What numbers whould be punched into x, y, and z to acquire certain desired effects?Also, what's the difference between moveTo and lineTo:

red line
style(1, "0xFF0000", 100);
plot(0, 0, 0);
draw(200, 0, 0);

View 4 Replies

ActionScript 3.0 :: Converting Papervision Coordinates Into Cartesian 2D Coordinates?

May 3, 2010

Im making a little app in flash using papervision I want to make a regular movieClip show up in the same place as a papervision object. The coordinates seem like perspective is affecting the number displayed.

View 2 Replies

Flex :: Prevent Container In ItemRenderer From Exceeding Width Of List Container?

Jul 2, 2011

In a Flex Mobile project I have a simple itemRenderer where I'm trying to create an "bubble" texting effect, similar to ichat or iphone (just so you get what im going for). But if the text is longer than the screen it runs off, rather than just going down a line.

If I set Group thats holding the rectangle(to create the bubble effect) and the label to 100% it works and keeps it from exceeding the list containers bounds, BUT the group is always at 100% and looks bad, I'm trying to keep the "bubble" JUST AROUND the text.

Anyway so, at the top of my itemRenderer I tried specifying:

<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" width="100%" height="100%">

And here's my layout I figured since msg_container has a width of 100% I was hoping bubble_lable_group would just not exceed that but...it doesnt...it just runs off. I tried setting a max width but that does not allow you to input percents. And just to say it 1 more time. I know if i set bubble_lable_group width to 100% it works, and keeps it from going off the edge, but then the rectangle "bubble" stretches all the way across and just looks bad.

<s:VGroup id="main_container" horizontalAlign="left" paddingBottom="10" paddingTop="10"
verticalAlign="top" width="100%">

[Code]....

View 1 Replies

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

Flex :: Dynamically Adding Container To A Dynamic Container

Sep 21, 2011

I have a loop that goes through data from a book and displays it. The book is not consistent in it's layout so I am trying to display it in two different ways. First way(works fine) is to load the text from that section in to a panel and display it. The second way is to create a new panel (panel creates fine) and then add collapsable panels(nested) to that panel. Here is the code from the else loop.

else if (newPanel == false){
// simpleData is just for the title bar of the new panel
// otherwise the panel has no content

[Code]....

The error I get is: ReferenceError: Error #1069: Property panel4.4 not found on components.readTest and there is no default value.

I have tried setting the "name" property instead of the "id" property.

View 1 Replies

Flex - Hide Container Of A Viewstack Container?

Dec 23, 2010

I have a viewstack container w/ 3 views: red, black, and blue. How can I completely hide the black & not include it?

[Code]...

View 2 Replies

Flex :: Drag Circle From One Container To Another Container?

Jan 13, 2012

I am creating an flex Air project,so mxml file will run. I have circles in one Big circle at one side and will be same on other side.

Now how to drag any circle from any Big circle to other side. Or it could be like any two container having circles, then how to drag and drop circle?

For one circle i am able to do drag and drop.But I want one Big circle on left hand side and one big circle on right hand side .And small circles with class names will be in these big circles.Now i want to drag and drop those small circles in big circles.Big cicles should not move. Even i have tried this code in actionscript

package
{
import flash.display.Sprite;
import flash.events.MouseEvent;

[Code].....

But in this i want big circles should not move and small circles should only be dragged.

View 1 Replies

ActionScript 3.0 :: Scale Container In Another Variable Container?

May 6, 2010

I need to place an image into a container. The problem is that I will not know the size of the image or the container beforehand, so it all has to be dynamic.this is how I started (have not gotten to stage(or container) changing size yet. No matter what I try, either all the images are the same width, or they are all the same height. If some images are portrait and other landscape, I don't want all the images to be X pixels high. In this variation of the code, all the images turn out the same height, regardless of portrait or landscape.

ActionScript Code:
var ratio:Number = container.width/container.height;//get the ratio, if width is bigger than height then ratio is greater than 1, else ratio is smaller than 1

[code]........

View 0 Replies

Flex :: Moving Children Of A Container (defined In MXML) Inside An "inner Container"

Jan 27, 2010

I'm currently working on a custom component which extends Canvas (let's call it SuperCanvas) ; it's basically a container that let you zoom & pan its contents. It would be too long to explain why, but I can't use scrollRect, so I was forced to declare a Canvas object (called innerCanvas)... inside my SuperCanvas (I know, not very nice =/) I would like to know if there's a proper way to "redirect" the creation of my component's children in this canvas.

[Code]...

View 1 Replies

FLV To SWF Conversion?

Feb 25, 2010

I often recieve FLV files for work and need to convert them to SWF. I know that flash imports FLA files but not FLV... I converted the FLV the F4V, opened it in flash, exported it as a SWF and it worked great... once.After that it rendered a white screen. How can I take an FLV file and properly convert it to a SWF suitable for web serving?

View 1 Replies

Flash To DVD Conversion

Aug 6, 2010

I have been creating animations for children, and recently finished an animated short. I am more of an artist than a techie, and I have not been able to find a clear cut answer as to what is the best way to convert flash to DVD. What file should be converted to achieve the best quality? SWF? MOV file? Is there a way to do it from flash? from Adobe Premier? I tried the AVI output and the quality was terrible.

Is a seperate converter needed? If so, are which give the best quality audio and visually? Here are some of the basic requirements for an animated short entry: DVDs must be compatible with standard set-top DVD players-- do not simply burn a quicktime or AVI file to a disc as data. It is highly preferred that you send us an NTSC, Region 1 or region free (Region 0) DVD when submitting to us, but we will also accept PAL and SECAM formats as well. If you are sending a DVD that has a region code other than 0 or 1, and/or a format other than NTSC, please mark this CLEARLY on the disc AND on the DVDcase.

View 2 Replies

ActionScript 3.0 :: AS1 To AS3 Conversion?

Jun 28, 2011

I have buttons across the way that are going to listen if they are clicked and if they are clicked it performs a test that says "if i'm not on this page then go to it"I'm a script kiddy I'll admit so I copy paste and go with what works. My compiler errors are down drastically when publishing to AS3.
 
[code]...

View 14 Replies

ActionScript 3.0 :: Swf To Jpg Conversion?

Jul 14, 2011

I am working on a project in which i need to convert swf file to jpg and mail it to customer.So for converting swf to jpg i used as3corelib the all code run successfully but the converted image is not showing in php page.my script is as follows,

my flash as3 script is follows :

import com.adobe.images.JPGEncoder;
import flash.display.BitmapData;
import flash.utils.ByteArray;
import flash.net.URLRequest;

[code]....

View 0 Replies

ActionScript 2.0 :: Swf To Jpg Conversion?

Jul 19, 2011

how to convert swf movie clip to image format(jpg,gif) using action script 2.0.I successfully done this using action script 3.0 But my project in action script 2.0.

View 0 Replies

ActionScript 3.0 :: Mp3 Array Conversion To Xml?

Jul 23, 2009

i've been working throught the great book, Quote:'foundation flash for designers'I thought i'd play around with an mp3 player, the example below uses an array for the mp3's, i want to load them using xml.whatever i'm doing i'm getting lots of errors, i have done xml loading before but this seems a bit more difficult.

PHP Code:
var songList:Array = new Array("alternative.mp3", "rockfunk.mp3", "chill.mp3");
var isPlaying:Boolean = false;

[code]....

View 1 Replies

Professional :: New User With Swf Conversion?

Feb 2, 2010

I make basic promo videos for some of my clients & a couple need the file in swf format.Currently I am using iMovie (for basic image to image cross disolves). I am learning Premier Pro& plan on using that in the next month or so.iMovie exports in .mov format. What is the best way of converting to swf? Would it be media encoder to FLV, then Flash to SWF?
 
I am using Mac OS 10.5.6 & I have CS4

View 1 Replies

Actionscript 3 :: JSON To XML Conversion

Dec 20, 2010

There are options to do it using Java and JS. And these options can be clubbed with AS3 but is there something out-of-the-box in native AS3 to do it.

View 3 Replies

ActionScript 2.0 :: String Conversion To XML?

Feb 19, 2009

I created a thread about converting an .as file to xml and then back. I asked too mny questions in that thread, I apologize...I was being greedy. Does anyone know how to, once you have a string, convert it to XML.

View 0 Replies

ActionScript 3.0 :: Conversion Of Swf To Flv Dynamically?

Nov 5, 2009

Is it possible to convert swf to flv dynamically.

View 0 Replies

ActionScript 3.0 :: Fast RGB To HSV Conversion

May 7, 2009

Searched around for this one a bit. Kinda sucks that there are a lot of synonyms for HSV.

HSB, HLS, HSL, HSB, HBS, etc.

Basically Hue, Saturation and ( Brightness / Value / Luminosity ).

What I am trying to accomplish is an extremely fast way to convert 24-bit RGB values to 24-bit HSV values. I've tried a few different ways with somewhat unexpected results.

Using a lookup table for every 24-bit color eats tons of memory and is actually slower than calculating the values on-the-fly (doesn't make sense to me).

Here's a partial example of what I currently use:

Code:
package org.peaceoutside.utils
{
public class ColorMath
{

[Code]....

View 3 Replies

ActionScript 2.0 :: WAV 2 SWF Batch Conversion?

Jan 17, 2005

I have a whole bunch of WAV files, and for each of them I am to create a SWF file, which will contain this WAV (of course compressed as MP3) on the first frame, and then on a separate leyer there will be a stop action on the last frame, corresponding to length of this WAV. The SWF is supposed to have the same name as WAV. I s there any way to automate this process?

View 1 Replies

ActionScript 3.0 :: What Is The Conversion Of Onload Event

Jul 8, 2009

I have following code on AS2 . Now I need to convert into AS3.

[Code]...

View 2 Replies

Professional :: Why Does Flv Conversion Muddy The Quality?

Apr 21, 2010

I am converting a regular movie from Windows moviemaker wmv export (exported at highest quality) and converting it with Xilisoft flv converter (at highest quality upon conversion) and I noticed the output quality of the final FLV is degradated a little. Some of the symptoms are: lower light, slight pixelation,and loss of crisp detail. Audio sounds great but why does the picture lose it's clarity from how it looks in moviemaker? I can see the crispness of the outlines in the video in Moviemaker, but in the final flv, it loses that. Is there anything I can do to make it keep it's original crisp look like how it looks in MM, or do you have to expect a loss of quality when using flvs?

View 4 Replies

Professional :: FLV Conversion With Media Encoder

Sep 21, 2010

I am using the CS5 media encoder to convert mp3 movies to flv for a site. The encoder is bringing the video over fine but not the audio.

View 3 Replies

ActionScript 3.0 :: Conversion Of A String To A Number?

Dec 14, 2010

I have a problem sending a String as a number..
 
I have a text field called score0 :-
 
var score = score0.text;
 
The string (score0.text) will have an "s" at the end as the time is counted in seconds and tenths, so I will be receiving something along the lines of "8.1s" as a value.. I would like to take score0.text, remove the "s" then *1000 the amount as a number before use..

View 3 Replies

ActionScript 3.0 :: Math Formula Conversion?

Jun 21, 2011

I'm not that good with Math and i have a formula for a that it's universal from what i understood but i dont know how to transform it to work with Flash's Math API. 

View 2 Replies







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