
|
If you were logged in you would be able to see more operations.
|
|
|
OpenLaszlo
Created: 30/Aug/06 07:12 PM
Updated: 14/Sep/06 04:19 AM
|
|
| Component/s: |
LFC - Text
|
| Affects Version/s: |
None
|
| Fix Version/s: |
3.4
|
|
| Severity: |
Minor
|
| Fixed in Change#: |
1,838
|
| Runtime: |
N/A
|
| Flags: |
Support
|
| Fix in hand: |
False
|
|
Hi,
I am having a problem updating the "fontsyle" attribute for a lazy replicated text object when compiling into swf8.
in the same swf8 compilation, this problem is not happening.
For swf7, I can update the "fontstyle" attribute properly for both regular replicated text object and lazy replicated text object.
To better exhibit the issue, I included a testcase.
Thanks.
Sanjaya
<canvas debug="true">
<dataset name="ds">
<root>
<text name="my-yellow-10-plain" fgcolor="0xFFFF00" fontsize="10" fontstyle="plain"/>
<text name="my-blue-11-bold" fgcolor="0x0000FF" fontsize="11" fontstyle="bold" />
<text name="my-red-12-italic" fgcolor="0xFF0000" fontsize="12" fontstyle="italic" />
<text name="my-green-13-bolditalic" fgcolor="0x339900" fontsize="13" fontstyle="bolditalic" />
</root>
</dataset>
<datapointer name="dp" xpath="ds:/root"/>
<method name="refresh" args="c, startIndex">
<![CDATA[
var arr = [];
var currIndex = startIndex;
var max = 4;
for (var i = 0; i < max; i++){
Debug.write(i, " arr["+i+"] = dp.subnodes["+currIndex+"]");
arr[i] = dp.p.childNodes[currIndex];
//currIndex = Math.abs(max - (currIndex + count));
currIndex = (currIndex + 1);
if (currIndex == max)
currIndex = 0;
}
c.testtext.datapath.setNodes(arr);
Debug.write("refresh() ",arr);
]]>
</method>
<view>
<simplelayout axis="x" spacing="10"/>
<view>
<simplelayout />
<text fontstyle="bold" fontsize="15">Regular replication</text>
<button text="start 0" onclick="canvas.refresh(container,0)" />
<button text="start 1" onclick="canvas.refresh(container,1)" />
<button text="start 2" onclick="canvas.refresh(container,2)" />
<button text="start 3" onclick="canvas.refresh(container,3)" />
<button text="rapidclick">
<handler name="onclick">
<![CDATA[
var max = 20;
for (var i = 0; i < max; i++){
var j = i % 4;
canvas.refresh(container,j);
}
]]>
</handler>
</button>
<view id="container" height="200" width="300" bgcolor="gray">
<simplelayout />
<text name="testtext" resize="true">
<datapath xpath="ds:/root/text"/>
<handler name="ondata">
var dat = this.data;
this.setAttribute("text",dat.getAttr('name'));
this.setAttribute("fgcolor",dat.getAttr('fgcolor')*1);
this.setAttribute("fontsize",dat.getAttr('fontsize'));
this.setAttribute("fontstyle",dat.getAttr('fontstyle'));
</handler>
</text>
</view>
</view>
<view>
<simplelayout />
<text fontstyle="bold" fontsize="15">Lazy replication</text>
<button text="start 0" onclick="canvas.refresh(container2,0)" />
<button text="start 1" onclick="canvas.refresh(container2,1)" />
<button text="start 2" onclick="canvas.refresh(container2,2)" />
<button text="start 3" onclick="canvas.refresh(container2,3)" />
<button text="rapidclick lazy rep">
<handler name="onclick">
<![CDATA[
var max = 20;
for (var i = 0; i < max; i++){
var j = i % 4;
canvas.refresh(container2,j);
}
]]>
</handler>
</button>
<view id="container2" datapath="ds:/root" height="200" width="300" bgcolor="gray">
<simplelayout />
<text name="testtext" resize="true">
<datapath xpath="text" replication="lazy" />
<handler name="ondata">
var dat = this.data;
this.setAttribute("text",dat.getAttr('name'));
this.setAttribute("fgcolor",dat.getAttr('fgcolor')*1);
this.setAttribute("fontsize",dat.getAttr('fontsize'));
this.setAttribute("fontstyle",dat.getAttr('fontstyle'));
</handler>
</text>
</view>
</view>
</view>
</canvas>
|
|
Description
|
Hi,
I am having a problem updating the "fontsyle" attribute for a lazy replicated text object when compiling into swf8.
in the same swf8 compilation, this problem is not happening.
For swf7, I can update the "fontstyle" attribute properly for both regular replicated text object and lazy replicated text object.
To better exhibit the issue, I included a testcase.
Thanks.
Sanjaya
<canvas debug="true">
<dataset name="ds">
<root>
<text name="my-yellow-10-plain" fgcolor="0xFFFF00" fontsize="10" fontstyle="plain"/>
<text name="my-blue-11-bold" fgcolor="0x0000FF" fontsize="11" fontstyle="bold" />
<text name="my-red-12-italic" fgcolor="0xFF0000" fontsize="12" fontstyle="italic" />
<text name="my-green-13-bolditalic" fgcolor="0x339900" fontsize="13" fontstyle="bolditalic" />
</root>
</dataset>
<datapointer name="dp" xpath="ds:/root"/>
<method name="refresh" args="c, startIndex">
<![CDATA[
var arr = [];
var currIndex = startIndex;
var max = 4;
for (var i = 0; i < max; i++){
Debug.write(i, " arr["+i+"] = dp.subnodes["+currIndex+"]");
arr[i] = dp.p.childNodes[currIndex];
//currIndex = Math.abs(max - (currIndex + count));
currIndex = (currIndex + 1);
if (currIndex == max)
currIndex = 0;
}
c.testtext.datapath.setNodes(arr);
Debug.write("refresh() ",arr);
]]>
</method>
<view>
<simplelayout axis="x" spacing="10"/>
<view>
<simplelayout />
<text fontstyle="bold" fontsize="15">Regular replication</text>
<button text="start 0" onclick="canvas.refresh(container,0)" />
<button text="start 1" onclick="canvas.refresh(container,1)" />
<button text="start 2" onclick="canvas.refresh(container,2)" />
<button text="start 3" onclick="canvas.refresh(container,3)" />
<button text="rapidclick">
<handler name="onclick">
<![CDATA[
var max = 20;
for (var i = 0; i < max; i++){
var j = i % 4;
canvas.refresh(container,j);
}
]]>
</handler>
</button>
<view id="container" height="200" width="300" bgcolor="gray">
<simplelayout />
<text name="testtext" resize="true">
<datapath xpath="ds:/root/text"/>
<handler name="ondata">
var dat = this.data;
this.setAttribute("text",dat.getAttr('name'));
this.setAttribute("fgcolor",dat.getAttr('fgcolor')*1);
this.setAttribute("fontsize",dat.getAttr('fontsize'));
this.setAttribute("fontstyle",dat.getAttr('fontstyle'));
</handler>
</text>
</view>
</view>
<view>
<simplelayout />
<text fontstyle="bold" fontsize="15">Lazy replication</text>
<button text="start 0" onclick="canvas.refresh(container2,0)" />
<button text="start 1" onclick="canvas.refresh(container2,1)" />
<button text="start 2" onclick="canvas.refresh(container2,2)" />
<button text="start 3" onclick="canvas.refresh(container2,3)" />
<button text="rapidclick lazy rep">
<handler name="onclick">
<![CDATA[
var max = 20;
for (var i = 0; i < max; i++){
var j = i % 4;
canvas.refresh(container2,j);
}
]]>
</handler>
</button>
<view id="container2" datapath="ds:/root" height="200" width="300" bgcolor="gray">
<simplelayout />
<text name="testtext" resize="true">
<datapath xpath="text" replication="lazy" />
<handler name="ondata">
var dat = this.data;
this.setAttribute("text",dat.getAttr('name'));
this.setAttribute("fgcolor",dat.getAttr('fgcolor')*1);
this.setAttribute("fontsize",dat.getAttr('fontsize'));
this.setAttribute("fontstyle",dat.getAttr('fontstyle'));
</handler>
</text>
</view>
</view>
</view>
</canvas> |
Show » |
|
if (this.fontstyle == "bold" || this.fontstyle =="bolditalic"){
this.format += "<B>";
}
if (this.fontstyle == "italic" || this.fontstyle =="bolditalic"){
this.format += "<I>";
}
if (this.underline){
this.format += "<U>";
}
}