English 中文(简体)
闪电系统没有定义
原标题:Flashvars is undefined

我正试图利用闪电var把参数传给我的手。 我是用Swafobject来embe。 然而,我无法在 file夫档案中查阅这些闪电。 几周来我一直对此感到不安。 我搜索了互联网、手工艺文件以及与这个问题有关的其他问题。

Here is my js code using the swfobject to embed the swf file.

<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
var flashvars = {};
flashvars.name1 = "hello";
swfobject.embedSWF("Comics.swf", "myContent", "950", "650","9.0.0","expressInstall.swf", flashvars, flashvars,flashvars);
</script>

我的《html法典》将被用于植树。

<div id="myContent"></div>

The swf is embedded fine and produces the following

<object type="application/x-shockwave-flash" name1="hello" data="Comics.swf" width="950" height="650" id="myContent" style="visibility: visible; ">
    <param name="name1" value="hello">
    <param name="flashvars" value="name1=hello">
</object>

Again, the swf is embedded fine. I can see the content but the flashvars seems to be null. Here is my flash code that tries to access the flashvars

var flashVars = root.loaderInfo.parameters;
addChild(Util.newLabel("  FlashVars: " + flashVars+" "+root.loaderInfo,0,0,400,100,12,0x0));        


var y=0;
for(var i in flashVars){
    addChild(Util.newLabel("FlashVars:"+i+":"+flashVars[i],0,y+=30,300,100,12,0x0));
}

Util是一种习俗类I,即新劳工(包括:String,x:Number,y:Number,w:Number,h:Number,fontSize:uint, 彩色:uint)是一种回归标签成分的方法,其字体为正文,x 和 y 作为其所在地,w 及其尺寸等。 很有理由相信,这种残割是徒劳的,因此,我想知道我如何真正装上闪 flash?

我在管理该法典时应当看到一个变数清单。

PS:上面的闪电代码在主要时间段(使用闪电灯汇编我的代码)中编号,而Util则作为档案保存。 主要时间表的第一个框架的基本目标是[目标主要时间线]。

Let me know if you need more info. Thanks in advance.

最佳回答

闪电通过在URL内部或通过闪电中吸收变数来捕获这些变量,这些变量是关键/价值。 基本上,如果你有这样一席之地:

http://someurl.com/flashmovie.swf?testVariable=101&testVariable2=tank

试 测 可变性是关键因素,101是价值,你可以得出以下这些关键/价值。

    //creating a textfield for debugging
var _textField:TextField = new TextField();
_textField.autoSize = TextFieldAutoSize.LEFT;
_textField.border = true;
addChild(_textField);

//flashvars code
try {
    var valueString:String;
    var keyString:String;
    var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
    for (keyString in paramObj) {
        valueString = String(paramObj[keyString]);
        _textField.appendText("	" + keyString + ":	" + valueString + "
");
    }
}catch (error:Error) {
    _textField.appendText(error.toString());
}

希望这一帮助, 卡车

问题回答

我刚刚设立了一个超文本的网页,该页面像你一样(事实上,我复制/编辑了你的代码),然后在我的闪电一中,用以下(简单)代码:

import flash.text.TextField;

var myTextField:TextField = new TextField();    

var flashVars = root.loaderInfo.parameters;

myTextField.text = flashVars["name1"]+"!";

addChild(myTextField);

And when I open the HTML page I get a nice "hello!" on the screen as expected. Obviously I couldn t try your label creator component, but the line would be:

addChild(Util.newLabel(flashVars["name1"]+"!",0,0,400,100,12,0x0) );        

如果做不到这项工作,我要说,你在“Util.newLabel()”上有一些错误,我的建议是尝试我的简单版本,看看你能够以这种方式(你有麻烦的)接触闪var,然后检查与另一个方面发生什么。

希望这一帮助!





相关问题
Disable button tooltip in AS3

I want to disable the tooltip on certain buttons. The tooltip manager seems to be an all or nothing solution. Is it possible to disable the tooltip for just one or two buttons?

Sorting twodimensional Array in AS3

So, i have a two-dimensional Array of ID s and vote count - voteArray[i][0] = ID, voteArray[i][1] = vote count I want the top 3 voted items to be displayed in different colors, so i have a 2nd Array -...

Virtual Tour using sketch up, ajax, flash technologies

I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...

AS3 try/catch out of memory

I m loading a few huge images on my flex/as3 app, but I can t manage to catch the error when the flash player runs out of memory. Here is the what I was thinking might work (I use ???? because i dont ...

Red5 Security Tutorial

I am looking for a step by step tutorial on securing Red5 from intrusion. This seems to be a question that comes up alot in a google search, but is never really answered in a way that makes sense to ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

visible property of DisplayObject

For example I have a hierarchy of movie clips. mc1 is a child of mc, and mc2 is a child of mc1. Turns out that when I set mc1.visible = false; mc2.visible stays true. Is that supposed to happen?...

热门标签