• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Problem with Loader using stage resizing

Explorer ,
Jan 20, 2014 Jan 20, 2014

Copy link to clipboard

Copied

Hello, sirs, and ladies,

I want build 4 viewers ( as cam-viewer, top-, side. and front-viewer ) on one loader.

I show you about my workstation;

4viewer_loaded_from_one_loader.PNG

Is it ready? But i resize window and loader won't work because i have coded sometimes worng. If you know for fix slice 4 scaling.

Look out! It went worng

4viewer_loaded_from_one_loader_problemwith_scale.PNG

Here is my code:

package

{

          import deng.fzip.FZip;

          import deng.fzip.FZipFile;

          import flash.display.Loader;

          import flash.display.Sprite;

          import flash.display.StageAlign;

          import flash.display.StageScaleMode;

          import flash.events.*;

          import flash.net.URLRequest;

          import flash.text.TextField;

          public class FZipTest extends Sprite

          {

                    private var zip:FZip;

                    private var tf:TextField;

                    private var index:uint = 0;

                    private var count:uint = 0;

                    private var done:Boolean = false;

                    public function FZipTest() {

                              // lets not scale

                              stage.align = StageAlign.TOP_LEFT;

                              stage.scaleMode = StageScaleMode.NO_SCALE;

                              // status text

                              tf = new TextField();

                              tf.height = 20;

                              tf.width = 576;

                              addChild(tf);

                              // load zip

                              zip = new FZip();

                              zip.addEventListener(Event.OPEN, onOpen);

                              zip.addEventListener(Event.COMPLETE, onComplete);

                              zip.load(new URLRequest("icons.zip"));

                    }

                    private function onOpen(evt:Event):void {

                              addEventListener(Event.ENTER_FRAME, onEnterFrame);

                    }

                    private function onComplete(evt:Event):void {

                              done = true;

                    }

                    private function onEnterFrame(evt:Event):void {

                              // we only want to add 32 images at once to the display list

                              // to save a bit of processor load when zip is cached

                              for(var i:uint = 0; i < 32; i++) {

                                        // any new files available?

                                        if(zip.getFileCount() > index) {

                                                  // yeah, get it

                                                  var file:FZipFile = zip.getFileAt(index);

                                                  // is this a png in the icons folder?

                                                  if(file.filename.indexOf("icons/") == 0 && file.filename.indexOf(".swf") != -1) {

                                                            // yeah, display it

                                                            var loader:Loader = new Loader();

                                                            loader.loadBytes(file.content);

                                                            loader.x = (stage.stageWidth - loader.width) / 2 * (count % 2);

                                                            loader.y = (stage.stageHeight - loader.height) / 2 * Math.floor(count / 2);

                                                            loader.scaleX = stage.stageWidth + stage.width;

                                                            loader.scaleY = stage.stageHeight + stage.height;

                                                            addChild(loader);

                                                            count++;

                                                  }

                                                  index++;

                                        } else {

                                                  // no new files available

                                                  // check if we're done

                                                  if(done) {

                                                            removeEventListener(Event.ENTER_FRAME, onEnterFrame);

                                                  }

                                                  // and exit the loop

                                                  break;

                                        }

                              }

                              // display load status

                              tf.text = count + " files loaded";

                    }

          }

}

I am using Flex SDK by Apache 4.11.0 SDK.

There libraries i am using: fzip.swc and as3crypto.swc:

And externed swfs are using mxml:

app_1.swf = yellow

app_2.swf = red

app_3.swf = blue

app_4.swf = green

i have zipped 4 swf to icons/*.swf into icons.zip

I have problem with slice 4-scaling for 4 loaded swfs and it will resize like any 3D drawing application for Away3D.like Autotesk Maya 4 Viewer or Blender 2.6x or 2.7x.

Thanks for answer and suggestion.

Best regards,

Jens

Views

564

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines