小编alx*_*lxx的帖子

iPhone:如何用动画切换标签?

我正在使用标签栏驱动的应用程序中以编程方式切换选项卡UITabBarController.selectedIndex.我试图解决的问题是如何设置视图之间的过渡动​​画.即.从当前选项卡的视图到所选选项卡的视图.

第一个想法是使用UITabBarControllerDelegate它,但似乎在编程切换选项卡时不会调用它.我现在正在考虑UITabBarDelegate.didSelectItem:作为设置过渡动画的可能钩子.

有没有人设法为过渡动画?如果有,怎么样?

uitabbarcontroller uitabbar ios4

106
推荐指数
7
解决办法
5万
查看次数

切换语句和数字范围

如何在as3中创建switch语句以使该案例适用于整个数字范围?

if (mcPaddle.visible == true)
{
    switch (score)
    {
        case  10://10 to 100
            myColor.color = 0x111111;
            break;
        case 110://110 to 1000
            //etc etc
            break;
    }
}
Run Code Online (Sandbox Code Playgroud)

我已经尝试了多种方法使案例适用于10-100和110-1000之间的所有数字,但似乎无法找到一种方法来做到这一点,我找不到这样的事情的正确语法在as3.

actionscript-3

8
推荐指数
1
解决办法
1万
查看次数

AS3 TextField设置文本的上边距,因为一些字符被删除

我想弄清楚为什么有些字母(比如挪威语Å(Å))在顶部"o"的中间切出:

我的代码是这样的:

        var titleFormat:TextFormat = new TextFormat();
        titleFormat.size = textSize;
           // this is embedded font, and exported for action script, declared
        titleFormat.font = myFontBold.fontName;
        titleFormat.bold = true;
        titleFormat.color = parseInt("0x"+fontColor,16);

        var titleText:TextField = new TextField();
        titleText.defaultTextFormat = titleFormat;
        titleText.embedFonts = true;            
        titleText.antiAliasType = AntiAliasType.ADVANCED;
        titleText.text = "Å"+text;
        addChild(titleText);

        titleText.selectable = false;           
        titleText.wordWrap = true;          
        titleText.width = maskImg.width - 80;           
          // this should autosize to fit all text, but it doesn't the top of text
        titleText.autoSize = TextFieldAutoSize.LEFT;
        titleText.x = x; …
Run Code Online (Sandbox Code Playgroud)

flash margin actionscript-3 textfield

5
推荐指数
1
解决办法
2598
查看次数

为什么JQUERY克隆功能并为其添加ID并确认电子邮件值?

我正在处理2个棘手的UX JQuery问题.我正在使用JQuery克隆2个表单变量.如何索引,识别它们,以便我可以使用此ID标记它们.例如,如果我从选择框中选择3,我应该获得3行形式,并且在每行的左侧应该以数字开始1. form,2.form,3 form开头.

第二个问题我想要验证服务员[]对确认者[].我如何在克隆的HTML代码中执行此操作.

这是我的JSFiddle http://jsfiddle.net/tGprH/5/

这是我的HTML代码:

<select name="select" id="select">
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
</select>
<br/>
<p>Email address, Confirm Email Address</p>
#1 <input type="text" name="attendant[]"/>
<input type="text" name="confirmattendant[]"/>
<br/>

<div id="container">

</div>
Run Code Online (Sandbox Code Playgroud)

这是我的JQuery

$("select").change(function() {

    var select = parseInt($('#select').val() , 10);
    var $clone = '<input type="text" name="attendant[]" /><input type="text" name="confirmattendant[]" /><br/>';
    console.log($clone);
    var html = '';
    for(var i = 1;i< select ; i++){
        html += $clone;
    }
    $('#container').empty().html(html);
 }).change();
Run Code Online (Sandbox Code Playgroud)

javascript jquery email-validation

5
推荐指数
1
解决办法
105
查看次数

在AIR中使用bytearray加载Swf

我们要求AIR应用程序加载flex生成的swf,它使用SWFLoader加载flash生成的swf.这不符合要求.这会给出以下错误:SecurityError:错误#3226:当LoaderContext.allowCodeImport为false时,无法导入SWF文件.

这是我们的AIR应用程序.

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initApp()">
<mx:Script>
<![CDATA[

import mx.controls.SWFLoader;

[Embed(source="FlexLoadingFlash.swf")]
public var flexMovie:Class;

private function initApp():void {
    // First convert the Swf into MovieClip
    var movieclip:MovieClip = new flexMovie();

    // get the byteArray from movieClip
    var byteArray:ByteArray = movieclip.movieClipData; 

    var swfLoader:SWFLoader = new SWFLoader();

    // load bytearray into swfLoader
    swfLoader.source = byteArray;

    swfLoader.maintainAspectRatio = false; 
    swfLoader.percentHeight = vbox.height;
    swfLoader.percentWidth = vbox.width;
    swfLoader.invalidateDisplayList();
    swfLoader.invalidateSize();

    // now add the swfloader into container
    vbox.addChild(swfLoader); 
} 

]]>

</mx:Script>

<mx:VBox id="vbox" …
Run Code Online (Sandbox Code Playgroud)

apache-flex air flash

4
推荐指数
1
解决办法
7995
查看次数

如何为此编写CUDA全局函数?

我想将以下函数转换为CUDA。

void fun()
{
    for(i = 0; i < terrainGridLength; i++)
    {
       for(j = 0; j < terrainGridWidth; j++) 
       {
             //CODE of function
       }
    }
}
Run Code Online (Sandbox Code Playgroud)

我写了这样的功能:

__global__ void fun()
{
    int i = blockIdx.x * blockDim.x + threadIdx.x;
    int j = blockIdx.y * blockDim.y + threadIdx.y;

    if((i < terrainGridLength)&&(j<terrainGridWidth))
    {
           //CODE of function
    }
}
Run Code Online (Sandbox Code Playgroud)

我将terrainGridLength和terrainGridGridWidth都声明为常量,并为它们都分配了值120。我正在调用像

有趣的<<< 30,500 >>>()

但是我没有得到正确的输出。

我写的代码是正确的吗。我对代码的并行执行了解得不多。请向我解释代码将如何工作,如果我犯了任何错误,请更正我。

cuda

1
推荐指数
1
解决办法
2088
查看次数

每20秒调用一次Flash AS3功能

如何在AS3 Flash中设置增量功能.我正在尝试在我的视频启动时启动递增功能,然后每20秒运行相同的功能,直到视频停止.

就像是:

    my_player.addEventListener(VideoEvent.COMPLETE, completePlay);
    my_player.addEventListener(VideoEvent.PLAYING_STATE_ENTERED, startPlay);

   function startPlay(){
       startInc();
       //OTHER items are started and set within this function that do not have to do with the incremented function.
    }


   function completePlay(){
       //This is where the startInc is stopped but not removed since it will be used again.

    }


     function startInc(){
          //This function should run every 20 seconds.
     }
Run Code Online (Sandbox Code Playgroud)

flash function increment actionscript-3

1
推荐指数
1
解决办法
6501
查看次数