Author Topic: Problem with Stage resize  (Read 1488 times)

capdesuro

  • Jr. Member
  • **
  • Posts: 49
Problem with Stage resize
« on: October 27, 2009, 11:46:12 am »
Hi,

I'm using 1.38 (sorry, yet) instantiating it from Flash (with the addChild Stuff) and everything works fine.

My problem is that I'd like to use it in a Full Size SWF, so the Megazine Object is added from a container (a rectangle with the same size of the book and some graphics) on the stage, and this is fine too, but my problem is that when I resize the stage the container disappears, but only the container where the Megazine MovieClip is added. The point is the resizing works if I remove the addChild(mz) line.

Just to clarify:
- Megazine added from a container works fine.
- I've a Flash project that has to be resizable and the components have to be placed depending on the Stage size, so there's an event handler to manage this and this is working fine, except when I place the Megazine on this stage, as when the stage is resized the container where the Megazine is added just disappears.

I see at Main.as that there's an event handler for the Stage Resize, and may be this is the problem.

My question is: how can I put the MegaZine on a resizable stage?

Thanks and regards,
Pedro

capdesuro

  • Jr. Member
  • **
  • Posts: 49
Re: Problem with Stage resize
« Reply #1 on: October 27, 2009, 12:32:25 pm »
Quite strange...

First of all, forget my comment about the existing resize event handler in Main.as, because I understand that this is only to generate megazine.swf and I'm not doing that.

I've testing and the thing is that the container is not shown because the width and height of the container are wrong after a stage resizing.

In my Stage Resize Event handler I've this code to position the container:
          container.x = (stage.stageWidth-container.width)/2;
          container.y = (stage.stageHeight-container.height)/2;

And this works fine if I don't add the MegaZine object into the container. But when I use the addChild and the MZ is inserted, the first time is shown, but when I resize the Stage, then the width and height of the container are completely wrong. But if I change it to:
          container.x = (stage.stageWidth-990)/2;
          container.y = (stage.stageHeight-550)/2;

Then it works fine again... What could produce that the sizes of the container get crazy when the Megazine object is on it?

Thanks!

Florian Nücke

  • κρύα πόδια
  • Administrator
  • Hero Member
  • *****
  • Posts: 1989
  • MegaZine3 Developer
    • MegaZine3
Re: Problem with Stage resize
« Reply #2 on: October 27, 2009, 09:50:50 pm »
My guess is, that the sizes of the container get messed up, because of the masks used by the MegaZine instance (one of my favorite Flash oddities... masks contribute to the size of a DisplayObjectContainer -.-)... sooo... yes, you'll probably have to use fixed sizes. If the container size depends on the book's size (page size) you could try using the megazine.pageWidth (*2 I guess) and pageHeight properties instead of container.width and height.
For the Snark was a Boojum, you see.

Before you ask a question
          After you get an answer
  • please document your problem with the answer in the Project Wiki. (e.g. in the FAQs)
  • help others out if you can, by answering their questions on the forum.

capdesuro

  • Jr. Member
  • **
  • Posts: 49
Re: Problem with Stage resize
« Reply #3 on: October 27, 2009, 11:12:48 pm »
Danke Sehr! The by-pass is enough. I was afraid of something worse but if the only problem is this, it's OK.

The behaviour on a full-size (not full screen, but full browser size, 100%x100%) flash had another unexpected issue: when the zoom is activated it goes to full screen mode... can this be avoided?

BTW, Florian, I'm trying to migrate my project to v2 and it's not so straightforward. I'd appreciate if you could find time to make a short advice for inserting the MZ inside a MovieClip Container, including the folders to be distributed with the resulting SWF.

Best regards and congratulations for your work. I expect to be your customer soon!
Pedro

Florian Nücke

  • κρύα πόδια
  • Administrator
  • Hero Member
  • *****
  • Posts: 1989
  • MegaZine3 Developer
    • MegaZine3
Re: Problem with Stage resize
« Reply #4 on: October 28, 2009, 12:14:01 am »
For the fullscreen: in 1.38 it's book@zoomfs="false", in 2.0 it's book@galleryfs="false".

Migrating: there's a page covering most (hopefully all, but I might have forgotten some) attribute and other changes in the wiki:
http://megazine.mightypirates.de/wiki/index.php/Migration

One major difference when working with the instance (I might add that to the migration page too...) is that the size now has to be set manually, otherwise it's default to zero (or was it one? anyway, too small). So you'll have to set the size available to the instance yourself (the new Main class does this, too, always adjusting the size to match the available stage space).

As for folders and so, the biggest change are the plugins and gui folder, containing the plugin swfs and the gui definitions, respectively.

If you have more concrete questions, please don't hesitate to ask them! ;)
For the Snark was a Boojum, you see.

Before you ask a question
          After you get an answer
  • please document your problem with the answer in the Project Wiki. (e.g. in the FAQs)
  • help others out if you can, by answering their questions on the forum.