找不到什么不对的$ C $下的Adobe AIR [英] Unable to find whats wrong with this code for adobe air

查看:119
本文介绍了找不到什么不对的$ C $下的Adobe AIR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

的Adobe AIR应用程序的首次合作。不知道什么用下面的code中的错误。它不提醒无的值。

请看到的,保存数据()的getData()从这个<一个href="http://stackoverflow.com/questions/13212992/unable-to-get-a-saved-data-in-adobe-air-els/13214411#comment18005663_13214411">question.

 功能检查(){
                VAR D1 =的getData('ITEM1');
                VAR D2 =的getData('项目2');
                如果(D1和放大器;&安培; D2){
                    警报('是');
                } 其他 {
                    警报('无');
                }
            }

            SAVEDATA(ITEM1','值1');
            SAVEDATA('ITEM2','值2');
            //我知道,它的荒谬保存数据,然后重置。
            //但是,这就是主要的code ++工程。抱歉。
            air.EncryptedLocalStore.reset();
            检查();
 

解决方案

您正在检查之前,从ELS清除您的数据:

  

<一个href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/data/EncryptedLocalStore.html#reset%28%29"相对=nofollow> flash.data.EncryptedLocalStore.reset():清除整个   加密本地存储,从而删除所有数据。

我不知道你为什么这样做,或者它是如何工作的,甚至对你(你声称它是),但如果你说这是必需的,比它的需要。假设这是实际工作,而不是给你造成你很多要修改这样的逻辑,因为这是非常奇怪的问题。

此外,传递给状态参数应输入字符串和条件应该检查​​这些字符串的长度不为零。

试试这个:

 功能检查():无效
{
    VAR D1:字符串=的getData(ITEM1);
    VAR D2:字符串=的getData(项目2);

    如果(d1.length&安培;&安培; d2.length)
    {
        警报(是);
    }
    其他
    {
        警报(否);
    }
}

SAVEDATA(ITEM1,值1);
SAVEDATA(项目2,值2);

//这是贫民区!
air.EncryptedLocalStore.reset();

检查();
 

要避免错误和问题,应严格键入code。

Working with an adobe air app for the first time. Dont know whats the error with the following code. It is not alerting the "no" value.

Please see, the saveData() and getData() are from this question.

            function check(){
                var d1 = getData('item1');
                var d2 = getData('item2');
                if (d1 && d2) {
                    alert('yes');
                } else {
                    alert('no');
                }
            }   

            saveData('item1','value1');
            saveData('item2','value2');
            // I know that its ridiculous to save the data and then reset it.
            // But This is how the main code works. sorry.
            air.EncryptedLocalStore.reset();
            check();

解决方案

You're clearing your data from ELS before checking it:

flash.data.EncryptedLocalStore.reset(): Clears the entire encrypted local store, deleting all data.

I'm not sure why you are doing this or how it is even working for you (as you claim it is) but if you say it's required than it's required. Assuming this is actually working and not causing you problems you many want to revise this logic since it's very strange.

Also, the arguments passed to the condition should be typed as strings and the condition should check if the length of those strings are not zero.

try this:

function check():void
{
    var d1:String = getData("item1");
    var d2:String = getData("item2");

    if (d1.length && d2.length)
    {
        alert("yes");
    }
    else
    {
        alert("no");
    }
}   

saveData("item1","value1");
saveData("item2", "value2");

// This is ghetto!
air.EncryptedLocalStore.reset();

check();

To avoid errors and problems, you should strictly type your code.

这篇关于找不到什么不对的$ C $下的Adobe AIR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆