dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: I doubt this problem's new to MX.

  1. #1
    I'm a seasoned ActionScripter, and I hope this isn't embarassingly easy to fix. So I have this movie clip that I want to allow users to "set the size of" in inches. What's really happening is that they are entering the values that they want in inches into two input fields associated with the variables "bgWidth" and "bgHeight". For display purposes, I want the larger of the two dimensions always to be 220 pixels and the smaller to accurately reflect the aspect ratio the user has designated. Later I plan to add a measurement MovieClip which will actually scale to give them perspective on how big this thing is. But I haven't gotten to that yet, because this ain't working. Below is my code, please, tell me how easy this is to fix.

    I have a sneaking suspicion that the real problem may be with the "Target" bug in Flash, where you can type in a target name, but if you move the code around, like cutting from a frame and pasting onto an MC, it will lose track of its target (I know this sounds ridiculous, but it's real) and you have to retype or re-select the target.

    onClipEvent (load) {
    _root.bgWidth = 220;
    _root.bgHeight = 220;
    }
    onClipEvent (enterFrame) {
    if (_root.bgHeight > _root.bgWidth) {
    setProperty(_root.pallette.MC, _height, 220);
    setProperty(_root.pallette.MC, _xscale, _root.bgWidth(220/_root.bgHeight));
    } else if (_root.bgHeight < _root.bgWidth) {
    setProperty(_root.pallette.MC, _xscale, 220);
    setProperty(_root.pallette.MC, _yscale, _root.bgHeight(220/_root.bgWidth));
    }
    }

  2. #2
    I'm not just replying to this to push it back to the top of the list... in case you were wondering.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center