English 中文(简体)
将物体定位于具有规模的电影剪辑 第十和比额表
原标题:positioning objects relative to MovieClip that has scaleX and scaleY changed

需要一些帮助解决一个小问题。 I m在S3的数学上不会太热。 我有一部作为其他两部锡石的集装箱的锡石。 还有一个情况是,另一个有一系列热点。

(一) 变更比额表 景象的X和Y级,热点更没有线。 你们是否知道正确的方程式,这样,任何等级的表一将永远使热点出现在正确的位置?

我试图这样做:

hotspot.x *= scaleFactor;
hotspot.y *= scaleFactor;

但这可以大体分类。

最佳回答

您可以把集装箱而不是面貌扩大。 假设热点与景象有关,将热点放在单一集装箱内是明智的。 如果你目前的集装箱含有任何其他元素,你就应当只为地块和地块建立一个新的集装箱。

Edit:

pseudo code
hotspot1.x = pic.width * hx1;
hotspot1.y = pic.height * hy1;

你们将需要在情况扩大后发挥职能。

function onImageScaleComplete(event:Event):void
{
    updatePositions();
}

但是,在尚未扩大专题时,你必须先制定你的比额表因素。

  //an array to contain the new scale factors 
  var factors:Array = [];

  //an array containing the hotspots
  var hotspots:Array = [hotspot1 , hotspot2 /*etc... */];

  function setPoints():void
  {
    for( var i:int ; i < hotspots.length ; ++i )
         factors[i] = { xfactor: hotspots[i].x/pic.width , 
                        yfactor: hotspots[i].y/pic.height };    

  }

Then you can update like this , assuming the new width & height of the picture

  function updatePositions():void
  {
     for( var i:int ; i< hotspots.length ; ++i )
     {
       hotspots[i].x = factors[i].xfactor * pic.width;
       hotspots[i].y = factors[i].yfactor * pic.height;   
     }
  }
问题回答

暂无回答




相关问题
Disable button tooltip in AS3

I want to disable the tooltip on certain buttons. The tooltip manager seems to be an all or nothing solution. Is it possible to disable the tooltip for just one or two buttons?

Sorting twodimensional Array in AS3

So, i have a two-dimensional Array of ID s and vote count - voteArray[i][0] = ID, voteArray[i][1] = vote count I want the top 3 voted items to be displayed in different colors, so i have a 2nd Array -...

Virtual Tour using sketch up, ajax, flash technologies

I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...

AS3 try/catch out of memory

I m loading a few huge images on my flex/as3 app, but I can t manage to catch the error when the flash player runs out of memory. Here is the what I was thinking might work (I use ???? because i dont ...

Red5 Security Tutorial

I am looking for a step by step tutorial on securing Red5 from intrusion. This seems to be a question that comes up alot in a google search, but is never really answered in a way that makes sense to ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

visible property of DisplayObject

For example I have a hierarchy of movie clips. mc1 is a child of mc, and mc2 is a child of mc1. Turns out that when I set mc1.visible = false; mc2.visible stays true. Is that supposed to happen?...

热门标签