Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 ActionScript 3中的UILoader封面背景_Actionscript 3_Flash_Background_Actionscript_Uiloader - Fatal编程技术网

Actionscript 3 ActionScript 3中的UILoader封面背景

Actionscript 3 ActionScript 3中的UILoader封面背景,actionscript-3,flash,background,actionscript,uiloader,Actionscript 3,Flash,Background,Actionscript,Uiloader,我使用ActionScript3和UILoader组件来显示.jpg图像 我想要一个“covered background”结果,比如css属性: background-size : cover; 我测试了参数scaleContent(true或false): 但结果并不是真正的“覆盖背景” 我认为应该将scaleContent设置为false,并进行比率计算来修改UILoader组件的大小 这是个好办法吗?还有其他解决方案吗 谢谢。 Julien基于Alsacrations jQuery解决

我使用ActionScript3和UILoader组件来显示.jpg图像

我想要一个“covered background”结果,比如css属性:

background-size : cover;
我测试了参数scaleContent(true或false):

但结果并不是真正的“覆盖背景”

我认为应该将scaleContent设置为false,并进行比率计算来修改UILoader组件的大小

这是个好办法吗?还有其他解决方案吗

谢谢。
Julien基于Alsacrations jQuery解决方案():

这似乎有效

uilBackground.scaleContent = true; 
function backgroundCover(){
    var image_width:Number = uilBackground.content.width;
    var image_height:Number = uilBackground.content.height;

    var over = image_width / image_height; 
    var under = image_height / image_width; 

    var body_width = uilBackground.width; 
    var body_height = uilBackground.height; 

    if (body_width / body_height >= over) { 

        uilBackground.content.width = body_width;
        uilBackground.content.height = Math.ceil(under * body_width);
        uilBackground.move(0,(Math.abs((under * body_width) - body_height) / -2));

    }else{
        uilBackground.content.width = Math.ceil(over * body_height);
        uilBackground.content.height = body_height;
        uilBackground.move((Math.abs((over * body_height) - body_width) / -2),0);
    }

    //trace(uilBackground.content.width);
    //trace(uilBackground.content.height);  
}