23-03-2012, 10:05
|
|
|
חבר מתאריך: 11.02.04
הודעות: 16,543
|
|
בעיה במעבר למסך מלא, לא עובד כמצופה!
יש לי מובי קליפ ענק..(יחסית למסך). (המטרה היא רקע למשחק).
עכשיו אני לא מבין מדוע הקוד הבא לא מציג לי את המובי קליפ בצורה כזו שכל הרוחב שלו נכנס לי בדיוק למסך, מדוע נשארת רצועה מימין, וחלק מהתמונה עדיין בצד שמאל של המסך?
קטע קוד ממש פשוט+ סקרין שוט של מה שאני מקבל..
קוד:
package {
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.display.Stage;
import flash.display.StageDisplayState;
import flash.display.StageScaleMode;
import flash.events.ContextMenuEvent;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import flash.ui.ContextMenu;
import flash.ui.ContextMenuItem;
[SWF(width=550,height=400,backgroundColor=0XD3D1D1, frameRate=35)]
public class Scroler extends Sprite{
private var clip:MovieClip;
private var stage_:Stage;
public function Scroler(){
clip=new BPic();
this.stage_=stage;
stage_.align=" ";
stage_.scaleMode=StageScaleMode.NO_SCALE;
clip.x=stage_.stageWidth/2;
clip.y=stage_.stageHeight/2;
stage_.addChild(clip);
clip.scaleX=stage_.fullScreenWidth/clip.width;
clip.scaleY=stage_.fullScreenWidth/clip.width;
var fullscreenCM:ContextMenu = new ContextMenu();
fullscreenCM.hideBuiltInItems();
fullscreenCM.addEventListener(ContextMenuEvent.MEN U_SELECT, menuHandler);
var fs:ContextMenuItem = new ContextMenuItem("Go Full Screen" );
fs.addEventListener(ContextMenuEvent.MENU_ITEM_SEL ECT, goFullScreen);
fullscreenCM.customItems.push( fs );
var xfs:ContextMenuItem = new ContextMenuItem("Exit Full Screen");
xfs.addEventListener(ContextMenuEvent.MENU_ITEM_SE LECT, exitFullScreen);
fullscreenCM.customItems.push( xfs );
// finally, attach the context menu to a movieclip / *OR* this..
this.contextMenu=fullscreenCM;
}
private function goFullScreen(event:ContextMenuEvent):void {
stage_.displayState = StageDisplayState.FULL_SCREEN;
}
private function exitFullScreen(event:ContextMenuEvent):void {
stage_.displayState = StageDisplayState.NORMAL;
}
private function menuHandler(event:ContextMenuEvent):void {
if (stage.displayState == StageDisplayState.NORMAL) {
event.target.customItems[0].enabled = true;
event.target.customItems[1].enabled = false;
}
else {
event.target.customItems[0].enabled = false;
event.target.customItems[1].enabled = true;
}
}
}
}
נערך לאחרונה ע"י The_Equivocator בתאריך 23-03-2012 בשעה 10:08.
|