ActionScript 3.0 ::movieclip In Edit Mode - Objects Won't Centre ?
Jun 5, 2011
I'm trying to get my new character system working with my fairly simple physics system. I have code at the bottom of the page which demonstrates my collision function. The most important line, which I've bolded, is:
Code:
currentPlayer.y = hitBlock.y - ((hitBlock.height * 0.5) + (avatar.height * 0.5)) ;
I wrote this myself, all logic dictates that it should work. We start with the position of the centre of the block. We add half of it's height, to reach the top surface of the block. And then we add half the avatar's height, which should give the exact point to put him at so that his feet touch the top of the block. This code should be able to account for any arbitrary heights of block or avatar. But it's not working, my avatar is stuck just a little bit inside the block.As far as I'm aware, my math is perfect. So the only source of the problem I can think of is in the objects themselves. I'm not fully sure what the registration point is - logic would dictate that it's the recognised root point of the object, and when I tell an object to go to a coordinate, I would guess it's moved so that point rests exactly on the coords.I'm not entirely sure how to change it though.When I look at my movieclip in edit mode, it look like this.
The image has been downscaled so it's tricky to see the details, but I want to draw attention to the fact that there's three points of interest on it. Around the middle of the bounding box is a white circle,I think that's the registration point. A bit above that, on the figure's upper torso, is a crosshair. And to the topleft of the bounding box, just outside of it, is a second crosshair.What's also interesting is that when I deselect the movieclip, the white circle and the second crosshair (outside the BB) vanish. But the one on his chest stays put.If I move the movieclip, all three of the above things go with it. I can select the circle and drag it around, but not the crosshairs.my collision code:
Code:
//if main hits a block, then stop jumping
//this loop will check a hit test with any block
for(var i:int = 0;i < world.blockHolder.numChildren; i++)[code]............
View 2 Replies
Similar Posts:
Jul 22, 2009
Just a quick one. Using AS3, how would I ensure that a movieClip always stays in the centre of the stage on resize?
View 1 Replies
Dec 3, 2009
This is my semi-finished art project URL...If you open it normally (providing you have a webcam) it works perfectly however I'm looking to showcase the piece on a projector and need to have it full screen.[code]I have made the piece so that the "orbs" rotate around the center point and the diamter of the rotation alters dependant on the activity level of the webcam. It looks very pretty when you open the swf. normally but when full screened the centres of rotation are completely off.Whats the best way around this? I'm in desperate need of full screen capability! [code]ps forgot to mention. all code is inside a blank movieclip called "orb" and then a copy of the movieclip is placed in every corner but flipped/rotated to achieve the butterfly/symmetry effect. this is the issue i belive that effects the full screen stuff.
View 1 Replies
Jan 17, 2010
I have a Tree Control inside my Flex Application which I want to edit on a doubleclick on a tree item. I found the properties doubleClickEnabled= "true", doubleClick="startEditMode()", and editable="true". With these functions I can detect a double click and I can change the editable property to true based on a double click. The problem is that after I double clicked on a Item i have to click once more to really enter the edit mode. That doesn't seem to be intuitive at all..
View 3 Replies
Mar 6, 2011
How to have that movieClip created to be created at the centre of the screen?
View 1 Replies
Jan 5, 2012
I'm trying to drag & rotate a planet so it spins around with the mouse -instance name: PlayerThe code works really well but it doesn't seem to rotate around the centre, instead it rotates from the top left corner.I'm quite a noob at as3 so I'm not quite sure where I've gone wrong with my code to be able to fix this. Do I need to specify the dimensions of the stage or the planet? I have altered the Stage from the the default 550 x 400 (if this could be the problem).
ActionScript Code:
import flash.events.MouseEvent;
import flash.events.Event;
[code].....
View 2 Replies
Apr 3, 2009
I posted a question regarding how to make a ladybug move around the screen and I managed to make a class that loaded a ladybug png then using a timer moves the bug around the screen...
but I have a huge problem...this has been bugging me all day and cannot find a solution...
The ladybug moves around the screen but rotates towards the moving direction before moving. The problem is that the ladybug is rotating at 0,0 axis and not at the centre of the movieClip. Is there a way to offset the registration point so that the ladybug rotates centred?
[Code]...
View 1 Replies
Apr 27, 2011
I'm writing a Flex application using Flash Builder 4 and I'm having a bit of trouble with an AS3 object.Essentially, it is a BorderContainer, with a few buttons and images, and programming logic that determines how these interact with eachother and a database.
What I want to be able to do is configure the layout/style of the inner components using MXML and CSS. I can configure the inherited objects, but not ones that I have defined.[code]...
View 2 Replies
Dec 21, 2011
when i convert an object to a symbol and edit it into Edit in Place and getting out of Symbol Editing Mode after the change have been made, the edited objects are also showing on stage.
View 2 Replies
Mar 25, 2009
I'm new to the whole flash thing and I'm learning on flash 8 - In photoshop you can group layers so that the blending mode you use on a layer will only apply to the layers in that group... I've been searching all over, and maybe it's right in front of me, but does flash have a way of isolating the selected blending mode to just the layers or objects of the user's choice?
View 6 Replies
Jul 28, 2011
i am wondering from this code, it makes the stage full screen, does it also makes the content of my movieclips scaled to full screen? i have tried this code and it does not seem to do that, how can i make my content to scale to fill a stage's full screen? i have a Movieclip containing a background with a class to make special effects on the background, i am having trouble making the background be "fullscreened" nicely with the stage.
View 1 Replies
Jun 14, 2008
My task is to show a video player in a full screen mode. Ihave no problem doing that but I need it to perform in a such a waythat only video scales to the full screen while other objects(player controls) remain unscaled. If I just go to the fullscreenmode - everything on the stage is scaled up naturally.Playing with the full screen features I could come up withthe only solution which is to calculate a scaling factor (based on,say, stage.width and stageWidth) and adjust player controlsdimensions and position accordingly.Is it the best way to preserve objects sizes or there is abetter technique?I hoped that because each display object has it's own stageand I could show full screen only video by doing something like:
_video.stage.fullScreenSourceRect = screenRectangle;
_video.stage.displayState = StageDisplayState.FULL_SCREEN;
but it still expands all the objects.
View 15 Replies
Dec 7, 2010
Consider the following Flex code:
private function fullScreenHandler(evt:FullScreenEvent):void {
if (evt.fullScreen) {
viewstack.selectedIndex = 2;
[Code].....
I have a viewstack with two containing canvases. Canvas 1 is used when in normal mode and canvas 2 which is used when in full screen mode.
To properly resize the objectInViewStack2 I need to know how large the screen is when in full screen mode.
View 1 Replies
May 20, 2009
You know normally when you are on a stage and then you click into on movieclip on the stage you see the other stage items faded out still and can edit the specific movieclip you are in, like soo.the normal mode for clicking on symbol on the stage.you can still see the faded stage elements in the background.screen1.jpg (30.81 KiB) Viewed 454 times
View 1 Replies
Nov 17, 2010
I wanted to make a video player that has normal mode and fullscreen mode. The part I am having trouble understanding is how to handle the video once it gets set to fullscreen. Do I just use the current video or do I get a high quality version of the video to show during fullscreen mode? What would be best practice for this situation?
View 1 Replies
Aug 8, 2011
I have a set of users who run my application in non debug mode. Off late they have been reporting lot of issues. But I am not able to debug as there is no log file.Is it possuible in flex 3 to do logging in a file without running in debug version. I understand trace only works if we run application in debug version.
View 1 Replies
Jul 22, 2009
I was aware that an array is filled from 0, but it was easier to lay it out that way for myself.
View 2 Replies
Sep 16, 2009
I've got a question concerning a button on my site but I can't get it to work. This is my code and I've tried to put
ActionScript Code:
logo_mc.buttonMode = true;
on several places
[Code] .....
View 2 Replies
Aug 11, 2009
I'm actually relatively new to flash and actionscript but I could say I have fair knowledge about them. So anyway, I usually build flash websites the traditional way using timeline animation and scripting. Today I had a job interview and they said they're looking for someone who can develop any web design into a Flash CMS with a back-end office for the client to edit the content without having to edit the FLA file or any code.
Accordingly, I'd like to know where and how to start. What are the main concepts I should follow/adapt?
View 1 Replies
Jun 17, 2009
I have a custom cursor movieClip that changes depending on which side of the screen its on in my Flash application. This works fine, and even when the Flash test window is resized. However when going to fullscreen mode, it stops working. This code is called every frame, so shouldnt the stageWidth/stageHeight adjust accordingly when going to fullScreen mode?
[Code]...
View 1 Replies
Jul 17, 2008
I'm trying to work out how to trigger a fullscreen on a movieclip from a button/AS-code in the parent. In the parent, I have a button that calls the function toggleFullScreen(), and here is the AS-code;
Code:
// Scale to fit the screen, but keep aspect ratio.
Stage.scaleMode= StageScaleMode.EXACT_FIT;
[code].......
View 10 Replies
Jan 5, 2010
I'm trying to follow along with a basic animation tutorial online using ActionScript. It mentions to switch to expert mode from normal mode, but says that to do this, I need to click on a blue arrow with a box around it(which I don't see anywhere)? Where would I click to switch to expert mode? Is expert mode needed to animate certain things(I'm working with a movie clip)?
View 1 Replies
Aug 8, 2011
Say User uploads a front facing photo. I give co-ordinates. I want to give user facility to move the points to match eyes and lips on their uploaded photo. So I want to get the editable shape. I think we will need to use bezier curves for this. How can I modify my code to line through the bezier control points?
View 1 Replies
Feb 26, 2002
I want to load Variables from a .txt-file to edit the properties of a movieClip. For example: 700 is written in the .txt-file. After loading the Clip the x-position of the clip should be set to 700. How can I do this?
View 14 Replies
Sep 18, 2008
I have a small problem with my fullscreen mode.It enters fullscreen mode nicely when the user click on a button and exit as well when you press the"esc" key (which is the standard). is there a way to track when i exit the full screen because i want to make some MovieClip to re appear at their initial position.
View 1 Replies
Oct 23, 2009
I have multiple points on a Google map that i need to pinpoint.How would i find the two points that are farthest away from each other and get my map center an zoom accordingly?[code]Just copy and paste into root time line to test
View 1 Replies
Mar 9, 2005
I have seen a couple of flash movies of late that have a nifty element to them, when the user resizes his window the movie slides to the centre or relative position, rather than snapping.THIS SITE is one example of the effect I mean When you resize your window the text moves gradually to a relative position.How is this done? is it via action scripting or through the html/java?It is a nice little touch, I like it. Do you think if you can dictate the position of certain elements you can dictate the size of elements according to window size?
View 9 Replies
Feb 12, 2009
Using this code:
[Code]...
I have a compass that is rotating depending on the position of the mouse, however it rotates it from the top left of the stage not the movie clip, how to get the AS to recognise the centre of the compass.. Also, I thought a nice touch would be if the compass had a slight "wobble"
View 1 Replies
Sep 13, 2010
i am struggling to work something out here and am hoping that someone on here can put me right...i have a flash movie that uses a liquid type layout (ie all from top left to fill the stage) - part of the movie is a navigation that when clicked slides around the stage to set positions.the problem is that the nav co-ordinates (points it travels to) are all based around top left of the stage, and i need to make it work from the centre of the stage.this is an example of one slide actions on one of the buttons named CLEAR:
PHP Code:
panel.CLEAR.onRelease = function(){
yTargetMC = 325;
[code].....
View 2 Replies
Jul 6, 2011
I have been struggling with the affect the browser zoom level has on my application for days. Finally I built the below test swf and noticed that when user zoom in using the browser zoom (IE 8) the box centering stopped working correctly.Movie with moviclip named box and button named mybtn with three text fields:
[Code]...
View 1 Replies