Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   ActionScript 3.0 (http://www.flasher.ru/forum/forumdisplay.php?f=83)
-   -   изменить stageWidth stageHeight (http://www.flasher.ru/forum/showthread.php?t=127626)

kup 18.07.2009 22:37

изменить stageWidth stageHeight
 
Вроде как свойства stageWidth, stageHeight доступны, как на чтение так и на запись. Хотел сделать считывание из XML ширины и высоты, а затем менять их у флешки, но новые значения почему-то игнорируются без каких либо ошибок. Поделитесь опытом, возможно ли это?. :)

iflamberg 18.07.2009 22:46

из флеш нет. Средствами js можно.

DeliMIter 19.07.2009 02:22

Вроде как перед тем, как задавать вопрос, стоит хотя бы прочитать статью хелпа по теме, а не только узреть [read-write] в заголовке.

Цитата:

When the value of the scaleMode property is set to StageScaleMode.NO_SCALE, the stageWidth property represents the width of Flash Player. This means that the stageWidth property varies as you resize the Flash Player window. When the value of the scaleMode property is not set to StageScaleMode.NO_SCALE, the stageWidth property represents the width of the SWF file as set during authoring in the Document Properties dialog box. This means that the value of the stageWidth property stays constant as you resize the Flash Player window. This property cannot be set.

kup 19.07.2009 18:51

А что у тебя за хелп такой?! Я перед тем как спросить, конечно прочитал, что об этом думает хелп:

Цитата:

stageWidth property

stageWidth:int []

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9

Specifies the current width, in pixels, of the Stage.

If the value of the Stage.scaleMode property is set to StageScaleMode.NO_SCALE when the user resizes the window, the Stage content maintains its defined size while the stageWidth property changes to reflect the new width size of the screen area occupied by the SWF file. (In the other scale modes, the stageWidth property always reflects the original width of the SWF file.) You can add an event listener for the resize event and then use the stageWidth property of the Stage class to determine the actual pixel dimension of the resized Flash Player window. The event listener allows you to control how the screen content adjusts when the user resizes the window.

Note: In an HTML page hosting the SWF file, both the object and embed tags' width attributes must be set to a percentage (such as 100%), not pixels. If the settings are generated by JavaScript code, the width parameter of the AC_FL_RunContent() method must be set to a percentage, too. This percentage is applied to the stageWidth value.

Implementation
public function get stageWidth():int
public function set stageWidth(value:int):void

Throws
SecurityError — Calling the stageWidth property of a Stage object throws an exception for any caller that is not in the same security sandbox as the Stage owner (the main SWF file). To avoid this, the Stage owner can grant permission to the domain of the caller by calling the Security.allowDomain() method or the Security.allowInsecureDomain() method. For more information, see the "Security" chapter in Programming ActionScript 3.0.

See also
flash.display.StageScaleMode

kackbip 19.07.2009 19:11

в хелпе CS3 есть "This property cannot be set."

kup 19.07.2009 19:32

В CS4 и на сайте они это убрали. Хочется что-то вроде этого.

Код AS3:

stage.stageWidth = 800;
stage.stageHeight = 600;
stage.dispatchEvent(new Event(Event.RESIZE));


Psycho Tiger 19.07.2009 20:16

kup, как ты себе это представляешь? Банер разъезжается на весь экран и нужно ждать 2 минуты чтобы его закрыть, и пользователь уходит с сайта ничегонеподозревающего сайтовладельца?

etc 19.07.2009 20:30

stageWidth и stageHeight установить нельзя.

kup 19.07.2009 20:38

да почему сразу баннер. :) Пусть бы хоть как fullscreen по запросу пользователя срабатывал. Мне надо сделать флешку для просмотра xml-файла с определенной информацией. Это информация визуализируется с помощью прямоугольных блоков. Их размер и количество задается в файле. Было бы удобно подгонять ширину флешки, как "кол-во блоков" * "ширина блока". Или, например, при resize округлять ширину по размеру блока.

Psycho Tiger 19.07.2009 20:39

Ты не понял. Если такую возможность получат адекватные флешеры - такую же получат и неадекватные, поэтому её отрубили и правильно сделали.


Часовой пояс GMT +4, время: 17:35.

Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.