热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

错误#1014:类mx。核心::无法找到位图资产。-VerifyError:Error#1014:Classmx.core::BitmapAssetcouldnotbefound

Imtryingtouseaway3dtoloadatexture.Everythingworksfineexceptwhenembeddingatexturein

I'm trying to use away3d to load a texture. Everything works fine except when embedding a texture inside the project, it crashes and gives that

我试着用away3d来加载纹理。一切都很好,除了在项目中嵌入一个纹理时,它会崩溃并给出它。

error: VerifyError: Error #1014: Class mx.core::BitmapAsset could not be found. 

The code for embedding the texture:

嵌入纹理的代码:

[Embed(source="../embedded/texture.jpg")]
public var reelTexture:Class;  

I'm using Adobe flex builder 3, Away3d 4.1.

我正在使用adobeflex builder 3, Away3d 4.1。

1 个解决方案

#1


1  

The problem is that you don't have framework.swc/core.swc/flex.swc (depending of your Flex SDK version) in your project library path, however linking this swc can lead in increasing the size of your application by ~200kb when compiled with mxmlc, even if you don't use flex directly.

问题是您没有frame .swc/core.swc/flex。在您的项目库路径中,swc(取决于您的Flex SDK版本),但是当使用mxmlc编译时,即使不直接使用Flex,连接这个swc也会导致应用程序的大小增加~200kb。

I recommend you do the following (we do this in our pure as3 projects):

我建议您做以下工作(我们在纯as3项目中这样做):

1.Create flex library project named flex4embedapi (or flex3embedapi depends on the version of Flex SDK you use in your main project)

1。创建名为flex4embedapi的flex库项目(或flex3embedapi取决于您在主项目中使用的flex SDK的版本)

2.Create file classes.as:

2。创建文件一夫:

package
{
    import mx.core.BitmapAsset;
    import mx.core.ByteArrayAsset;
    import mx.core.FontAsset;
    import mx.core.SoundAsset;
    import mx.core.SpriteAsset;

public class classes
{
    public function classes()
    {
        ByteArrayAsset;
        SpriteAsset;
        BitmapAsset;
        FontAsset;
        SoundAsset;
    }
}
}

3.Be sure this class is included in the library including list (Project->Properties->Flex library build path->Classes)

3所示。确保这个类包含在库中,包括列表(项目->属性->Flex库构建路径->类)

4.Copy flex4embedapi.swc to the lib folder (folder with linked swc libraries) of your project.

4所示。flex4embedapi副本。swc到项目的lib文件夹(带有链接swc库的文件夹)。

All should works now.

现在应该工作。

UPD: For quick fix try this config file for Flex SDK 4.6 (-load-cOnfig=config.xml) it's 100% works for as3 project without any other linked libraries:

UPD:要快速修复这个配置文件,请尝试Flex SDK 4.6 (-load-cOnfig=config.xml),它100%适用于as3项目,没有任何其他链接库:


    11.1.0
    40

    
        
            en_US
        

        
            ${flexlib}/libs/player/{targetPlayerMajorVersion}.{targetPlayerMinorVersion}/playerglobal.swc
        

        
            ${flexlib}/libs/core.swc
            ${flexlib}/libs/player/{targetPlayerMajorVersion}.{targetPlayerMinorVersion}    
        

        true

        false
    

Test project contains the only main class embedtest.as:

测试项目包含唯一的主类嵌入。

package
{
import flash.display.Sprite;
import flash.utils.ByteArray;

public class embedtest extends Sprite
{
    [Embed(source="somefile.txt", mimeType="application/octet-stream")]
    private static const some_file:Class;

    public function embedtest()
    {
        var b:ByteArray = new some_file();
        trace(b.length);
    }
}
}

推荐阅读
author-avatar
jimmychoong_959
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有