PDA

View Full Version : [CLOSED] FlashComponent object.name Attribute



vgvallee
Mar 05, 2013, 8:01 PM
I would like to have the name attribute set on the object generated by the FlashComponent, so that I end up with something like this:



<object id="objectid" name="objectname" type="application/x-shockwave-flash" width="100%" height="100%" data="url.swl">
<param..... />
</object>


I have not found if it's possible in the FlashComponent markup to add the name attribute.

name="objectname"

How can I do this?

Baidaly
Mar 05, 2013, 11:59 PM
Hello!

You should use the following:


<CustomConfig>
<ext:ConfigItem Name="flashAttributes" Value="{ name: 'objectname' }" Mode="Raw" />
</CustomConfig>

Daniil
Mar 06, 2013, 3:58 AM
Hello,

We have added the FlashAttributes property for the FlashComponent control.

Thank you for the question.

vgvallee
Mar 06, 2013, 5:18 PM
Just to clarify as to the why and also maybe you can tell me if that would be desirable or not: I have found that in order for


flash.external.ExternalInterface.objectID

in ActionScript to work on all browsers and return a consistent value, the name attribute must be set to the same as the id on the object tag element. IE is good with the id but FF and others use the name. Could there be an option to set this automatically (copy the id in the name attribute) instead of having to do it manually? At this point, I would have to find out what the attribute of id is at runtime, and then set the name attribute on it...

Daniil
Mar 07, 2013, 7:59 AM
What about to set up the same id and name explicitly?

vgvallee
Mar 08, 2013, 5:29 AM
Yes, something that would allow to set both the id attribute and the name attribute on the object tag of the FlashComponent, either to the automatic id or to another value that is specified by the user. Maybe the FlashAttributes method can be used for that, assuming the automatic id is not set when it is already supplied by the user.

Daniil
Mar 08, 2013, 10:28 AM
Sorry, maybe I misunderstand something, but this makes an id and an name to be equal.


<FlashAttributes>
<ext:Parameter Name="name" Value="someValue" Mode="Value" />
<ext:Parameter Name="id" Value="someValue" Mode="Value" />
</FlashAttributes>

vgvallee
Mar 08, 2013, 6:53 PM
That would do it for a fixed name. How would you do it for an automatic name, like "extswf1031" that is auto-generated (in case that this control is included more than once on the same page)?

Daniil
Mar 11, 2013, 6:08 AM
For each new control you could set up its own FlashAttributes, could not?

Maybe, I misunderstand something in the scenario. Could you provide a sample which would reproduce the problem?

vgvallee
Mar 11, 2013, 4:41 PM
Without posting files, this may be hard for you to test...

My problem is with Flash. From within Flash in ActionScript, you can call the ExternalInterface.objectID property to get the reference to the object tag in the DOM. The problem is that IE is using the id attribute which is currently always set whereas other browsers, such as FF, use the name attribute of the object tag which is never set.

In the case of the FlashComponent, the object tag is given an auto-generated id but not a name attribute. So when the ActionScript is run inside the *.swf, the ExternalInterface.objectID is defined for IE but is null for FF.

What I am asking for is an option to set the name attribute on the object tag for the FlashComponent to either a supplied value or to an auto-generated value. Something like:



<ext:FlashComponent runat="server" ID="flash" SameObjectNameAsID="true" />


would copy the ID, supplied in this case, to the name attribute. Or if ID isn't supplied, copy the auto-generated id.

Or:



<ext:FlashComponent runat="server" ID="flash" ObjectName="flashname" />


to set the name to something else than the ID.

If nothing is set, then behave like now: no name attribute on the object tag.

Daniil
Mar 12, 2013, 5:29 AM
Thank you for the details.

Maybe, it is possible to implement that logic within a Success handler. Something like this:

<ext:FlashComponent ...>
<Listeners>
<Success Handler="item.swf.set({ name: item.swf.dom.id});" />
</Listeners>
</ext:FlashComponent>

See also
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.flash.Component-event-successhttp://docs.sencha.com/ext-js/4-1/#!/api/Ext.flash.Component-property-swf

vgvallee
Mar 12, 2013, 5:44 PM
This worked perfectly.