Android Air As3 - jerky movement strategy Lag

Hi, im new to this forum so please forgive me if I have a question in the wrong section.

I have a problem with Android Air Performance when moving from a movieclip (interpolation) inside a movieclip to a strategy game.

Let me explain what my structure looks like:

I have a Movieclip named 'BG' 1280x720pixel preparing to drag Double click on the mouse event that works very well. Inside the BG movieclip, I have an another Movieclip called "Builder". The code below is the "constructor" to move. However, my problem is that when it moves on a Tween and I drag the movieclip "BG" at the same time, occurs a jerky movement.

I tried to put the movieclip "Builder" in the same location on another layer than the movieclip "BG", by twisting the AS3 code and works fine but the manufacturer only moves from the stage and NOT in the BG movieclip.

What I want is (located inside the BG movieclip) movieclip generator to move smoothly while being able to drag the BG movieclip at the same time. However it does not lag...

CODE for the movement of generator:

var targetX:Number;

var targetY: number;

var inTransit: Boolean = false;

var speed: Number = 5;

stage.addEventListener (MouseEvent.MOUSE_DOWN, mouse click);

stage.addEventListener (Event.ENTER_FRAME, update);

function mouseClick(e:MouseEvent):void

{

targetX = BG.mouseX;

targetY = BG.mouseY;

transit = true;

}

function update(e:Event):void

{

First check to see if we must move forward

If (! transit | isNaN (targetX) | isNaN (targetY)) return;

find the direction to the target

var i: Number = targetX - BG.builder.x; x direction

var j: Number = targetY - BG.builder.y; y axis

Now let's see how close you are to the target

If you're closer, then speed, then make sure that the amount of your change

mag var: Number = Math.sqrt (I * i + j * j);

var dif:Number = Math.min (mag, speed);

If (dif < speed) in transit = false; turn off transit when you got it

now make your direction a unit vector

I / = mag;

j / = mag;

then multiply by your dif to get

the speed of your object vector

I * = dif;

j * = dif;

If (off = true) {}

BG.builder.x += i;

BG.builder.y += j;

}

}

CODE FOR the event drag mouse 'BG ':

BG.addEventListener (MouseEvent.DOUBLE_CLICK, fl_StartDrag, false, 0, true);

BG.addEventListener (MouseEvent.MOUSE_UP, fl_StopDrag, false, 0, true);

function fl_StartDrag(e:MouseEvent):void

{

OFF = false;

e.currentTarget.startDrag (false, fl_DragBounds);

e.currentTarget;

counter = 1;

BG.addEventListener (Event.ENTER_FRAME, updateCounter);

}

function fl_StopDrag(e:MouseEvent):void

{

e.currentTarget;

e.currentTarget.stopDrag ();

BG.removeEventListener (Event.ENTER_FRAME, updateCounter);

}

How can I do to fix the problem, and why is this problem or delay?

Please forgive me as I'm new to Flash and still learn

Thank you

AlpaxJ1

every object that has x, y of changes (and no other changes) should have its cacheAsBitmap property enabled.

each object which undergoes additional changes (excluding the movieclips that change managers) must have its active cacheAsBitmap and its cacheAsBitmapMatrix assigned (usually at a new matrix())).

Tags: Adobe Animate

Similar Questions

  • HOW TO CHANGE THE WALLPAPER FOR ADOBE AIR AS3 IN BB10?

    HOW TO CHANGE THE WALLPAPER FOR ADOBE AIR AS3 IN BB10?

    Please only start a thread.

    Original thread:

    http://supportforums.BlackBerry.com/T5/Adobe-AIR-development/changing-background-wallpaper-BBZ10/TD-...

  • Why the cursor of my moving the mouse in jerky movements?

    I am using Windows 7 and have a new mouse Microsoft.  Any kind of surface, I place the mouse, the cursor moves in jerky movements.  It is difficult to get to the right spot.  I changed the block but no difference.

    Hello

    If it is a mouse ball rolling, remove the ball and clean the internal rollers.

    If it is an optical mouse, try it on another surface, ideally with a uniform color.

    Cross of test with another mouse if symptoms persist.

    Tricky

  • I am one of my apps Android AIR of CS5.5 to animate the portage. I can't download on devices running &lt; 4 Android. The problem seems to be that the default Android SDK of AIR conditioning with Animate is version 20, but &lt; 4 Android devices seems to b

    I am one of my apps Android AIR of CS5.5 to animate the portage.

    I can't download it to devices that run Android 2.3.x versions. The problem seems to be that by default what android SDK of AIR conditioning with Animate is version 20, but the devices running Android 2.3.x seem to be stuck on the AIR 19 runtime. I downloaded Android SDK of AIR 19, but when I tried to switch to it using 'manage AIR SDK... "I get an error message saying that I can't upgrade to a version of AIR lower than the preinstalled version. Still, I have many users using devices that run Android < 4 versions and won't leave stranded. What can I do to fix this?

    Yet can the old way to overlay a term I used in CS5.5, be used? I never tried to superimpose an OLDER version of the SDK on CS5.5, then perhaps it would not have worked either.

    In the part of the descriptor XML app Android, you can set the minimum level of SDK, like this:

    This has been very convenient for the times where I wanted to make sure someone is on Android 4.0 or later. But it may be worth trying as a way to override the default used by AIR. You can try to use the 9 or 10, depending on whether you think that your users would have at least to 2.3.4.

    Or, do not worry them, they always take advantage of your old version.

  • 24 fps video does not play in the source CS5.5 without jerky movement monitor

    Problem: 24 fps video does not play in the monitor source CS5.5 without jerky movement. 30 frame will play well. I took the same shot 24 fps, using the same exact configuration settings and it played in my CS5.0. No problem. I have them side by side and checked to make sure everything was EXACLTY the same. The 24 frames per second call played smoothly in the monitor source CS5.0 Panel. Can someone tell me what the solution might be to get the CS5.5 play smoothly? When I visited on the timeline in CS5.5 he played smoothly on the timeline. Puzzled.

    > nikon d7000

    This is probably the cause.

    See for a workaround:

    http://helpx.Adobe.com/Premiere-Pro/KB/Nikon-D7000-footage-stutters-playback.html

  • Android app for watching movies and music from PC directly to AT100

    do you know if there is an application for watching movies and music to my pc directly on my Tablet? such a mediacenter?

    Hello

    You can use the direct application of VLC on Android google play store.
    Also, the drive for Windows must be installed on your PC.

    Second option, you can use the VLC Stream & convert Pro Apps

  • development iPhone and android with as3, where should I start?

    Right, I built a game in as3.

    Now, I want to put on the market and apple android app store.

    I have box all my graphics dynamically through classes.

    I need to know at what stage of the size that I need. I currently have 550 by 400.

    How can I do it only in the landscape, so the step size landscape.

    What should I use for normal event listeners. What would be "addEventListener (MouseEvent.MOUSE_DOWN, click)" for iphone and android.

    What other important things I should know?

    Use google to find the train for the sizes of your target platforms.

    Check the settings in publication for orientation.

    MouseDown events work well on touch devices.

    There are many things you need to know.  Here is a starting point, http://www.adobe.com/devnet/devices.html

  • Resize and move windows LAGS

    I just did a clean install of Lion on my MBP 2.4 Ghz mid-2010 with 8 GB of RAM running Photoshop 12.0.4 and I feel a horrible when lag the movement or resizing of windows. It is the only application running and I test on any file size or one that is empty and just bee created.

    I did the following:

    -Restart the Mac

    -Fix the disc and repaired disk permissions

    -Quit all other applications and ensured that nothing not hogging the CPU in the activity monitor

    -The latest version of Photoshop and Mac OS X

    -Photoshop can now use up to 70% of available RAM

    Unfortunately none of this did something for remody problem.

    Ideas, help or advice would be much appreciated.

    See if the deactivation of drawing OpenGL in Edit - Preferences - Performance helps temporarily.  Be sure to close and restart Photoshop before the test.

    If this is useful, you can perhaps re - enable OpenGL, then experiment with the advanced variuos options and modes.  Don't forget to restart Photoshop after each change to make sure that you carefully test it.

    Good luck.

    -Christmas

  • AS2 to AS3 conditional movie clip function

    I had an AS2 script which would have melted all clips of movie except the rolls more than one. I'm trying to implement this script in AS3, but I can't seem to make it work. Can someone please tell me where I'm wrong? Thank you!

    Here is the AS2 script:

    function alpha (obj) {}

    for (var i = 1; i < = 24; i ++)

    {

    if (obj._name! = 'p ' + i).

    {

    var box_tween:Object = new Tween (_root.port ["p" + i], "_alpha", Regular.easeInOut, 100, 40, 1, true ");

    { } else

    {

    obj._alpha = 100;

    }

    }

    }

    Here is my attempt to translate this to AS3:

    function onButtonOver(e:MouseEvent):void {}

    for (var i: Number = 1; i < = 4; i ++)

    {

    if (e.currentTarget! = 'p ' + i).

    {

    var enterTween:Tween = new Tween (["p" + i], "alpha", None.easeOut, 1,.4, 1, true);

    { } else

    {

    e.currentTarget.alpha = 1;

    }

    }

    You are welcome.

    Please check the answer, if you can.

  • TextAreas and TextInputs playing havoc with the size of the parent (AIR/AS3)

    I'll start with an example:

    var testTF:TextField = new TextField();
    var testTA:TextArea = new TextArea();
    var testSpr:Sprite = new Sprite();
    
    testSpr.addChild(testTF);
    testSpr.addChild(testTA);
    
    testTA.width = 400;
    testTA.x = 200;
    
    trace(testSpr.width);
    

    Now, the track seems like it should spit 600, right? For some reason but it is only to spit the width as if testTF was the only thing in there. It is not just the tracing instructions that are weird either, this makes it difficult to position elements dynamically to the right of the testSpr. Is there something weird about how the TextAreas and TestInputs behave as children of another display object? If it makes a difference, this is part of a project AIR 2.0. Thank you.

    apply the validateNow() method to your text box before querying the size:

    .

    .

    .

    testTA.validateNow ();

    trace (testSpr.Width)

  • Jerky scrolling and lag in ncurse (CC)

    Hello

    I use Dreamweaver CC and the browsser file is so choppy and laggy when I scroll slike to move 2 FPS and jumps 30 folders at once.

    Terrible performance Adobe for so long. You have had this problem with CS6 already and scrolling was still quite slow. I have patience and I love your products, but you should fix that.

    Can I unsubscribe my account because the workt dosent correct software?

    Greetings

    Hi guys, thanks for reporting, we are aware of this problem, which has been there since the CS6 and investigating on this.

    I'll keep posted guys on this

  • AS3 FL4 Move Movie Clip

    Suppose that un has two buttons "left " " and a" entitled ' .
    le ' left ' moves to le left
    et the "right ". " to the right
    et the goal is to move the object " ball "
    based on ce potential requires only script to do this?

    Here is a version:

    var howFar:int = 5;

    left.addEventListener (MouseEvent.MOUSE_UP, moveLeft);

    right.addEventListener (MouseEvent.MOUSE_UP, moveRight);

    function moveLeft(event:MouseEvent):void {}

    ball.x += howFar;

    }

    function moveRight(event:MouseEvent):void {}

    ball.x = howFar;

    }

    Simply change the value of the variable howFar to change the distance that the "ball" is moved. "Ball" is moved whenever you click on one of the buttons.

    A second version:

    var howFar:int = 5;

    var moveLeft:Boolean = false;

    var moveRight:Boolean = false;

    left.addEventListener (MouseEvent.MOUSE_DOWN, leftDown);

    left.addEventListener (MouseEvent.MOUSE_UP, leftUp);

    right.addEventListener (MouseEvent.MOUSE_DOWN, rightDown);

    right.addEventListener (MouseEvent.MOUSE_UP, rightUp);

    stage.addEventListener (Event.ENTER_FRAME, onEf);

    function leftDown(event:MouseEvent):void {}

    moveLeft = true;

    }

    function leftUp(event:MouseEvent):void {}

    moveLeft = false;

    }

    function rightDown(event:MouseEvent):void {}

    moveLeft = true;

    }

    function rightDown(event:MouseEvent):void {}

    moveLeft = false;

    }

    function onEf(event:Event):void {}

    {if (moveRight)}

    ball.x += howFar;

    }

    {if (moveLeft)}

    ball.x = howFar;

    }

    }

    In this version the object "ball" will continue to move as long as the left or right button is pressed. It stops when the button is released.

    Either version, the 'balloon' will continue to move even after he left the visible area of the scene.

  • 7548 Inspiron 15.6 "series 7000 default Touchpad movement detection Lag

    Please answer if you don't HAVE the problem illustrated in the following two videos.

    I would like to find the best configuration to avoid or minimize the offset of motion detection. If you laptop works very well, please answer to tell me which touchpad driver you have installed.

    Here is a description of the problem by Da AugGust:

    "The Tablet seems to ignore the first half an inch of the movement since the starting point of the touch, so I could keep wriggling my finger around on the touchpad and ignore it as long as all entries sound within a half inch of starting point." After I go past the "activation threshold", then it follows perfectly, including the smallest movements"

    cs_setInnerHtml ('video_d0ff4a41-f112-4ccd - 9 c 22-8b7c6b82feaf', ");

    Here is a video of the same fault, but it shows how the defect causes problems with two fingers to scroll:

    cs_setInnerHtml ('video_8c9f1415-d1d9-449e - 814 b-6ae0fd8feca6', ");

    luccappe

    Please answer if you don't HAVE the problem illustrated in the following two videos.

    I would like to find the best configuration to avoid or minimize the offset of motion detection. If you laptop works very well, please answer to tell me which touchpad driver you have installed.

    Here is a description of the problem by Da AugGust:

    "The Tablet seems to ignore the first half an inch of the movement since the starting point of the touch, so I could keep wriggling my finger around on the touchpad and ignore it as long as all entries sound within a half inch of starting point." After I go past the "activation threshold", then it follows perfectly, including the smallest movements"

    (Please visit the site to watch this video)

    Here is a video of the same fault, but it shows how the defect causes problems with two fingers to scroll:

    (Please visit the site to watch this video)

    This morning, Dell told me that the problem affects all Dell laptop (not only inspiron 7548, but also xps) with the keys win8.1 and accuracy.

    They told me that's not a bug it's a feature.

    He comes to the end.

  • AS3 drag / move

    Hi all

    I have a problem with my drag and drop puzzle

    everything worked fine until I added that the draggable content to a movieclip called pieces_mc which should go the nextFrame after a target has been met.

    ask yourself if you can see what is wrong, I think I need to point the movieclip on event.target but how to do this?

    Stop();

    var startX:Number;
    var startY: number;
    var counter: Number = 0;
    var tent: Number = 0;

    finished_mc. Visible = false;
    help_file_mc. Visible = false;

    pieces_mc.jig1_mc.buttonMode = true;
    pieces_mc.jig2_mc.buttonMode = true;
    pieces_mc.jig3_mc.buttonMode = true;
    pieces_mc.jig4_mc.buttonMode = true;
    pieces_mc.jig5_mc.buttonMode = true;
    pieces_mc.jig6_mc.buttonMode = true;
    pieces_mc.jig7_mc.buttonMode = true;
    pieces_mc.jig8_mc.buttonMode = true;
    pieces_mc.jig9_mc.buttonMode = true;
    pieces_mc.jig10_mc.buttonMode = true;


    pieces_mc.jig1_mc.addEventListener (MouseEvent.MOUSE_DOWN, Pick-up);
    pieces_mc.jig1_mc.addEventListener (MouseEvent.MOUSE_UP, dropIt);
    pieces_mc.jig2_mc.addEventListener (MouseEvent.MOUSE_DOWN, Pick-up);
    pieces_mc.jig2_mc.addEventListener (MouseEvent.MOUSE_UP, dropIt);
    pieces_mc.jig3_mc.addEventListener (MouseEvent.MOUSE_DOWN, Pick-up);
    pieces_mc.jig3_mc.addEventListener (MouseEvent.MOUSE_UP, dropIt);
    pieces_mc.jig4_mc.addEventListener (MouseEvent.MOUSE_DOWN, Pick-up);
    pieces_mc.jig4_mc.addEventListener (MouseEvent.MOUSE_UP, dropIt);
    pieces_mc.jig5_mc.addEventListener (MouseEvent.MOUSE_DOWN, Pick-up);
    pieces_mc.jig5_mc.addEventListener (MouseEvent.MOUSE_UP, dropIt);
    pieces_mc.jig6_mc.addEventListener (MouseEvent.MOUSE_DOWN, Pick-up);
    pieces_mc.jig6_mc.addEventListener (MouseEvent.MOUSE_UP, dropIt);
    pieces_mc.jig7_mc.addEventListener (MouseEvent.MOUSE_DOWN, Pick-up);
    pieces_mc.jig7_mc.addEventListener (MouseEvent.MOUSE_UP, dropIt);
    pieces_mc.jig8_mc.addEventListener (MouseEvent.MOUSE_DOWN, Pick-up);
    pieces_mc.jig8_mc.addEventListener (MouseEvent.MOUSE_UP, dropIt);
    pieces_mc.jig9_mc.addEventListener (MouseEvent.MOUSE_DOWN, Pick-up);
    pieces_mc.jig9_mc.addEventListener (MouseEvent.MOUSE_UP, dropIt);
    pieces_mc.jig10_mc.addEventListener (MouseEvent.MOUSE_DOWN, Pick-up);
    pieces_mc.jig10_mc.addEventListener (MouseEvent.MOUSE_UP, dropIt);


    function pickUp(event:MouseEvent):void {}
    event.target.startDrag (true);
    reply_txt. Text ="";
    event.target.parent.addChild (event.target);
    startX = event.target.x;
    startY = event.target.y;
    }
    function dropIt(event:MouseEvent):void {}
    event.target.stopDrag ();
    var myTargetName:String = "target" + event.target.name;
    var myTarget:DisplayObject = getChildByName (myTargetName);
    If (event.target.dropTarget! = null & & event.target.dropTarget.parent == myTarget) {}
    Event.Target.Play ();
    pieces_mc.nextFrame ();
    borders_mc.parent.SetChildIndex (borders_mc, borders_mc.parent.numChildren - 1);

    reply_txt. Text = "Good Job! « ;
    event.target.removeEventListener (MouseEvent.MOUSE_DOWN, Pick-up);
    event.target.removeEventListener (MouseEvent.MOUSE_UP, dropIt);

    event.target.buttonMode = false;
    Event.Target.x = myTarget.x;
    Event.Target.y = myTarget.y;
    counter ++;

    } else {}
    reply_txt. Text = "Try! again « ;
    Event.Target.x = startX;
    Event.Target.y = startY;
    tent ++;
    }
    If (tent > = 15) {}
    tries_txt. Text = "fi";
    }

    If (counter == 10) {}
    borders_mc. Visible = false;
    targetjig1_mc. Visible = false;
    targetjig2_mc. Visible = false;
    targetjig3_mc. Visible = false;
    targetjig4_mc. Visible = false;
    targetjig5_mc. Visible = false;
    targetjig6_mc. Visible = false;
    targetjig7_mc. Visible = false;
    targetjig8_mc. Visible = false;
    targetjig9_mc. Visible = false;
    targetjig10_mc. Visible = false;
    pieces_mc.jig1_mc. Visible = false;
    pieces_mc.jig2_mc. Visible = false;
    pieces_mc.jig3_mc. Visible = false;
    pieces_mc.jig4_mc. Visible = false;
    pieces_mc.jig5_mc. Visible = false;
    pieces_mc.jig6_mc. Visible = false;
    pieces_mc.jig7_mc. Visible = false;
    pieces_mc.jig8_mc. Visible = false;
    pieces_mc.jig9_mc. Visible = false;
    pieces_mc.jig10_mc. Visible = false;
    finished_mc. Visible = true;
    reply_txt. Text = "congrats, you're done! « ;
    }
    }

    Thanks in advance for any help

    fonzio

    Line 11 of your code seems to be in the middle of the pieces_mc... buttonMode lines.  If this is the case, then I would say that among the instance names "Jig #_nc" could be a problem (misspelled, not, etc.).  If you know that the object that the code tries to target does not exist in this framework, then the only cure is to exist in this context.

  • AS3 auto-move position then repeat

    I'm doing something similar to a news slider where I get the contents of a TXT file then loop a news ticker. Currently, I have the job, and the automatically mobile text content. What I'm trying to do now is to repeat the text as soon as it goes off the screen, so it will be constantly scrolling. Here's what I have so far...

    content.addEventListener(Event.ENTER_FRAME, fl_AnimateHorizontally_2);
    
    function fl_AnimateHorizontally_2(event:Event)
    {
         content.x -= 10;
    
    }
    

    Any help would be greatly appreciated, thanks in advance!

    Try:

    content.addEventListener (Event.ENTER_FRAME, fl_AnimateHorizontally_2);

    function fl_AnimateHorizontally_2(event:Event)
    {
    Content.x-= 10;
    If (content .x + happy .width<>
    Content.x = stage.stageWidth;
    }

    }

Maybe you are looking for