can i change the viewport size dynamically?
can i change the viewport size dynamically?
hi,
i know i could set the os viewport size in component panel,and it works,
but if i want to change the os viewport size dynamically,i mean according to the stage width or something else,is it possible?
thx~~~
i know i could set the os viewport size in component panel,and it works,
but if i want to change the os viewport size dynamically,i mean according to the stage width or something else,is it possible?
thx~~~
Re: Changing viewport size
I was actually having a similar, simpler problem. I would like to know how to 'statically' resize the viewport for openspace, so that the openspace window is larger than 640x480.
If you happen to have some instructions about how to do this, it would be much appreciated.
Thank you!
If you happen to have some instructions about how to do this, it would be much appreciated.
Thank you!
Re: Changing viewport size
To clarify the above post, we are interested in exporting the Openspace libraries as an swc file for Flex to use with a larger viewport.
morgflast wrote:I was actually having a similar, simpler problem. I would like to know how to 'statically' resize the viewport for openspace, so that the openspace window is larger than 640x480.
If you happen to have some instructions about how to do this, it would be much appreciated.
Thank you!
hirokimo:
dinamically changing the size of the OpenSpace component is not possible. When initialized, OpenSpace "reads" the viewport size and it can't be changed later.
morgflast:
you need the Flex Component Kit for Flash.
Create a new fla in Flash and drag the FlexComponentBase component to its library.
Then create a new movieclip, set it to be exported for ActionScript and give it a class name (for example OpenSpaceWrapper) and set its base class as mx.flash.UIMovieClip.
Drag the OpenSpace component inside the movieclip and give it an instance name, for example os.
Then create the OpenSpaceWrapper.as class like this:
In the end, export the swc following the guidelines of the Flex Component Kit for Flash.
This has not been fully tested, but should do the trick: when you resize the wrapper in Flex, OpenSpace is resized accordingly. Of course what said to hirokimo is still valid: if you resize the wrapper after OpenSpace initialization, the OpenSpace behavior will be messed up.
Important: see this reply below for a possible issue and its workaround
dinamically changing the size of the OpenSpace component is not possible. When initialized, OpenSpace "reads" the viewport size and it can't be changed later.
morgflast:
you need the Flex Component Kit for Flash.
Create a new fla in Flash and drag the FlexComponentBase component to its library.
Then create a new movieclip, set it to be exported for ActionScript and give it a class name (for example OpenSpaceWrapper) and set its base class as mx.flash.UIMovieClip.
Drag the OpenSpace component inside the movieclip and give it an instance name, for example os.
Then create the OpenSpaceWrapper.as class like this:
Code: Select all
package
{
import mx.flash.UIMovieClip;
import mx.events.ResizeEvent ;
public class OpenSpaceWrapper extends UIMovieClip
{
function OpenSpaceWrapper()
{
_width = os.width
_height = os.height
}
override public function get measuredWidth():Number
{
return os.width
}
override public function get measuredHeight():Number
{
return os.height
}
override public function setActualSize(newWidth:Number, newHeight:Number):void
{
if (newWidth != _width || newHeight != _height)
{
_width = newWidth
_height = newHeight
os.setSize(_width,_height)
}
}
}
}
This has not been fully tested, but should do the trick: when you resize the wrapper in Flex, OpenSpace is resized accordingly. Of course what said to hirokimo is still valid: if you resize the wrapper after OpenSpace initialization, the OpenSpace behavior will be messed up.
Important: see this reply below for a possible issue and its workaround
Last edited by Bax on 25 Mar 2009, 16:33, edited 3 times in total.
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
to bax:
ok,i see,it`s unreasonable to change the viewport size when the os componet initialized.
to morgflast:
i`ve tested this way in flex(actionscript project),and it works
here`s my step:
1.export a swc file with os componet
2.add the swc into an actionscript project in flex.
3.var os:OpenSpace = new OpenSpace();
4.os.setSize(800,250); or you can, os.setSize(stage.stageWidth,stage.stageHeight);
5.load the os skin,os bg....
and as bax said,the size could not be resized again only if you reload the os.
thx u guys~
ok,i see,it`s unreasonable to change the viewport size when the os componet initialized.
to morgflast:
i`ve tested this way in flex(actionscript project),and it works
here`s my step:
1.export a swc file with os componet
2.add the swc into an actionscript project in flex.
3.var os:OpenSpace = new OpenSpace();
4.os.setSize(800,250); or you can, os.setSize(stage.stageWidth,stage.stageHeight);
5.load the os skin,os bg....
and as bax said,the size could not be resized again only if you reload the os.
thx u guys~
-
Paul Scherbak
- Posts: 4
- Joined: 23 Feb 2009, 08:09
- Location: Ukraine, Kharkiv
- Contact:
Hi!
I create OpenSpace component how is specified above, by means of OpenSpaceWrapper. I use MXML, AS3 in FlashDevelop. The component successfully created, avatars can move, but over tiles there is a white area.

And after a while it is informed on an error:
Help, please...
I create OpenSpace component how is specified above, by means of OpenSpaceWrapper. I use MXML, AS3 in FlashDevelop. The component successfully created, avatars can move, but over tiles there is a white area.

And after a while it is informed on an error:
Code: Select all
ReferenceError: The POWERED BY OPENSPACE text must be visible!
at com.smartfoxserver.openspace::OpenSpace/com.smartfoxserver.openspace:OpenSpace::onLinkTest()
at flash.utils::Timer/flash.utils:Timer::_timerDispatch()
at flash.utils::Timer/flash.utils:Timer::tick()Not clear why you have that white rectangle covering OpenSpace. Maybe you can send your code an we will give it a look.
The error is due to the fact that the rectangle partially covers the OpenSpace logo in the top-right corner (this is not allowed when using the evaluation version of OpenSpace).
The error is due to the fact that the rectangle partially covers the OpenSpace logo in the top-right corner (this is not allowed when using the evaluation version of OpenSpace).
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
It took a while, but we have an explanation to this strange behavior. It seems that Flex doesn't like the mask that the OpenSpace component uses internally to hide tiles and background portions outside of the viewport. That white rectangle is the movieclip which "should" become a mask.I create OpenSpace component how is specified above, by means of OpenSpaceWrapper. The component successfully created, avatars can move, but over tiles there is a white area.
The good news is that this issue show up only if you place the OpenSpaceWrapper (see code above) on the stage via ActionScript. If you create it directly inside the mxml and set its width/height, it works like a charm.
This issue has already been fixed in the engine of the next OpenSpace version (under development, please don't ask the release date!), which will be distributed as a Flex native component (side by side with a Flash native component).
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
-
Paul Scherbak
- Posts: 4
- Joined: 23 Feb 2009, 08:09
- Location: Ukraine, Kharkiv
- Contact:
-
Paul Scherbak
- Posts: 4
- Joined: 23 Feb 2009, 08:09
- Location: Ukraine, Kharkiv
- Contact:
The class an avatar is compiled by "publish" in Flash.nig3d wrote:one problem I have using flex or flash develop is that I can't compile the code of my avatar.
My avatar is a fla file which a movieclip inheriting from an OS avatar object so I can't compile it with flex.
Do you have some hints about it?