Adding Uicomponent in textflow
Hi sir,
We are facing some problems with new TLF framework. We need to add component(any UI component) in selected textflow. But we cant do that. We need any UI element (just like inlinegraphicElement for images) for UI components. now we can not add transform tool on the images. we need too add drag & drop propety on that, and the total text flow is affected. Please reply ASAP.
var displayObject:Sprite = new Sprite();
//ilg.source = displayObject;
Alert.show("Image added..");
if(_images==null){
_images=new Vector.<Bitmap>;
_container.addEventListener(MouseEvent.CLICK,handleMouseDown);
_container.addEventListener(MouseEvent.MOUSE_MOVE,handleMouseMove);
_img_loader.contentLoaderInfo.removeEventListener(Event.COMPLETE,imageLoadComplete);
var bmd:BitmapData=Bitmap(_img_loader.content).bitmapData;
bm=new Bitmap(bmd);
_images.push(bm);
but = new mx.controls.Button();
wrapper = but as DisplayObjectWrapper;
obj.addEventListener(MouseEvent.CLICK,handleMouseDown);
// EditManager(_textFlow1.interactionManager).
// EditManager(
EditManager(_textFlow1.interactionManager).insertInlineGraphic(wrapper,bm.width,bm.height );
_textFlow1.flowComposer.updateAllControllers();
i want to add image/bordercontainer with insertinlineGraphics with transform tool,and i want to drag & drop the the object on the TLF.
Similar Messages
-
When Setting Vertical Align on a TextFlow to VerticalAlign.MIDDLE or VerticalAlign.BOTTOM, The First TextFlowLine Selection and Caret is vertically offset with respect to the distance of vertical space between the top of the Container boundary and the top of the First Line of Text.
What is the trick to make the Text Selection line up on the First TextFlowLine when verticalAlign is not set to 'top'?
below is a simple code example that demonstrates it. The first line of text "Hello World" is positioned properly, however when you click on
the TextLine to edit it, the Caret appears some 100 pixels below where its supposed to, and so does the text selection.
I am loading this module within an app that is compiled in SDK 3.2
/****************************** BEGIN CODE ******************************/
package {
import flash.text.engine.BreakOpportunity;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.edit.EditManager;
import flashx.textLayout.elements.Configuration;
import flashx.textLayout.elements.ParagraphElement;
import flashx.textLayout.elements.SpanElement;
import flashx.textLayout.elements.TextFlow;
import flashx.textLayout.formats.TextLayoutFormat;
import flashx.textLayout.formats.VerticalAlign;
import mx.core.UIComponent;
public class TextFrameExample extends UIComponent
var textFlow:TextFlow;
public function TextFrameExample()
var config:Configuration = new Configuration();
var textLayoutFormat:TextLayoutFormat = new TextLayoutFormat();
textLayoutFormat.color = 0xFF0000;
textLayoutFormat.fontFamily = "_sans";
textLayoutFormat.fontSize = 22;
textLayoutFormat.breakOpportunity = BreakOpportunity.ANY;
textLayoutFormat.verticalAlign = VerticalAlign.MIDDLE;
config.textFlowInitialFormat = textLayoutFormat;
textFlow = new TextFlow(config);
var globalP:ParagraphElement = new ParagraphElement();
var p:ParagraphElement = new ParagraphElement();
var span:SpanElement = new SpanElement();
span.text = "Hello, World!";
p.verticalAlign = VerticalAlign.TOP;
p.addChild(span);
textFlow.addChild(p);
p = new ParagraphElement();
span = new SpanElement();
p.verticalAlign = VerticalAlign.TOP;
span.text = "Next Line should be split into some columns after all this right? i mean come on";
p.addChild(span);
textFlow.addChild(p);
p = new ParagraphElement();
span = new SpanElement();
span.verticalAlign = VerticalAlign.TOP;
span.text = "Next Line should be split into some columns after all this right? i mean come on";
p.addChild(span);
textFlow.addChild(p);
textFlow.interactionManager = new EditManager();
textFlow.flowComposer.addController(new ContainerController(this, 0, 0));
textFlow.flowComposer.getControllerAt(0).setCompositionSize(500, 500);
textFlow.flowComposer.updateAllControllers();
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
super.updateDisplayList(unscaledWidth, unscaledHeight);
textFlow.flowComposer.getControllerAt(0).setCompositionSize(unscaledWidth, unscaledHeight);
textFlow.flowComposer.updateAllControllers();
/****************************** BEGIN CODE ******************************/
Thanks for your time!
BowThe verticalAlign property in TLF works only at the TextFlow or container level. So you can set the verticalAlign for an entire component, but not for individual paragraphs or spans. That's something it would be nice to add in the future, but not supported now. Sorry.
- robin -
Rotated ASCII characters overlap in Text Layout Framework with specific Japanese/Chinese fonts
I am trying to layout rotated text with Text Layout Framework. Mostly okay, but when it comes to specific Japanese/Chinese fonts, problem happens - "hankaku" alphanumeric characters(in other words, ASCII characters) overlap in those fonts. (Full-width "zenkaku" characters have no problem, though)
When "HG丸ゴシックM-PRO" or "HG正楷書体-PRO" are specified as fontFamily(both come with Office - common fonts in Japanese Windows environment), characters are wholly overlapped.
When "SimSun", "NSimSun" or "SimHei" are specified as fontFamily(Chinese fonts, all come with Japanese Windows XP), characters are slightly overlapped.
If anyone knows a solution or a workaround to this, please let me know.
Sample code:
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initapp();">
<mx:Script>
<![CDATA[
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.elements.ParagraphElement;
import flashx.textLayout.elements.SpanElement;
import flashx.textLayout.elements.TextFlow;
import flash.text.engine.TextRotation;
import mx.core.UIComponent;
private function initapp():void
var container:UIComponent = new UIComponent();
var textflow:TextFlow = new TextFlow();
var controller:ContainerController = new ContainerController(container);
var paragraph:ParagraphElement = new ParagraphElement();
var span:SpanElement = new SpanElement();
textflow.fontFamily = "HG丸ゴシックM-PRO";
textflow.textRotation = TextRotation.ROTATE_270;
textflow.fontSize = 72;
textflow.color = 0;
span.text = "abcdefg";
controller.setCompositionSize(this.unscaledWidth, this.unscaledHeight);
paragraph.addChild(span);
textflow.addChild(paragraph);
textflow.flowComposer.addController(controller);
textflow.flowComposer.updateAllControllers();
this.addChild(container);
]]>
</mx:Script>
</mx:WindowedApplication>
Warm regards,
Yuushimamalachite00 wrote:
> Thanks David. So is there any way around having to embed
the font when
> rotating text?
Not that I know of. Your problem is that you're loading the
content
dynamically, so you have no idea what it will contain.
There's normally
no need to embed Japanese fonts for a Japanese audience,
because they
already have the main fonts, such as Mincho, Gothic, or Osaka
on their
machine. Perhaps you'll just have to give up the idea of
rotation.
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/ -
Hello,
I present here a simplified version of my problem. I
developed a little application which is drawing 3000 dots on a
canvas. My big trouble is the execution fastness of this
application.
I tried 2 methods :
- at first, I loop 3000 times, creating and adding
UIComponent objects on the canvas. This takes about 6 seconds. This
delay is too-long for my specifications fastness demand. If
understand correctly flash player mechanism, it's waiting for
making computations before displaying the execution, so that's a
blocking functionality.
- after, I tried to "oblige" flash player to displaying the
execution with a timer (and a framerate of 50). But this solution
is worst because flex draw again all previous dots already drawn.
Here is my source code (there are not comments, but it's a
simple code)
I'm looking for a solution which would permit me to get a
faster and smooth display.
Thanks.Hi and thank you for your response.
That's right, if I use only one UIComponent to draw my
circles, the display duration is better. But I need to identify
each point (in order to permit click or mouse over events), that's
why I need to draw each point on a single container.
We suggest me to use bitmapData, but I don't know this
object, and I'm always looking for how can I use this...
Thanks. -
Best practice for adding text to Flex container?
Hi,
I'm having some troubles to lay a TextFlow class out properly
inside a Flex container. What's the best practice to achieving
this, for example adding a lot of text to a small Panel?
Is it possible to pass anything other than a static width and
height to DisplayObjectContainerController constructor, or is this
not the place to implement this? I guess what I am looking for is
the layout logic I'd normally pack into a custom Flex component and
implement inside measure() and so on.
My use case: a chat application which adds multiple TextFlow
elements to a Flex container such as Panel. Or use TextFlow as a
substitute for UITextField.
Some example code would help me greatly.
I'm using Flex 3.2.
Regards,
StefanThanks Brian, the example helps. However problems quickly
arise if I modify it slightly to this (please compile it to see):
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute" initialize="init()">
<mx:Script>
<![CDATA[
import flashx.textLayout.compose.StandardFlowComposer;
import
flashx.textLayout.container.DisplayObjectContainerController;
import flashx.textLayout.container.IContainerController;
import flashx.textLayout.elements.TextFlow;
import flashx.textLayout.conversion.TextFilter;
private var _container:Sprite;
private var _textFlow:TextFlow;
private function init():void
_container = new Sprite();
textArea.rawChildren.addChild(_container);
var markup:String = "<TextFlow xmlns='
http://ns.adobe.com/textLayout/2008'><p><span>Hello
World! Hello World! Hello World! Hello World! Hello World! Hello
World! Hello World! Hello World! Hello World! Hello World! Hello
World! Hello World! </span></p></TextFlow>";
_textFlow = TextFilter.importToFlow(markup,
TextFilter.TEXT_LAYOUT_FORMAT);
_textFlow.flowComposer.addController(new
DisplayObjectContainerController(_container, 200, 50));
_textFlow.flowComposer.updateAllContainers();
]]>
</mx:Script>
<mx:Canvas width="100" height="100" id="textArea" x="44"
y="46" backgroundColor="#F5EAEA"/>
</mx:Application>
What is the best way to make my textflow behave like a
'normal' UIComponent in Flex? Should I use UIComponent instead of
Sprite as a Container? Will that take care of resize behaviour?
I have never before needed to use rawChildren.addChild for
example, maybe you can explain why that's needed here?
I realise that the new Textframework works on an AS basis and
is not Flex or Flash specific, but this also poses some challenges
for those of us using the Flex framework primarily.
I think it would help to have some more basic examples such
as using the new text features in a 'traditional' context. Say for
example a TextArea that is just that, a TextArea but with the
addition of inline images. I personally feel that the provided
examples largely try to teach me to run before I can walk.
Many thanks,
Stefan -
TextFlow and Controller Being Created Too Early?
I've successfully rolled my work with the TextFlow into a
Canvas component, made it into an SWC, and made that part of the
application it was originally designed for. No problems. Alright,
now time to re-use my work in another app. that could benefit from
a rich text component. Went through the usual motions and got all
of my UI for my text component to render except the TextFlow!
Then what I discovered is when I resized the browser window
that hosting my Flex app, the cascade of resize events got the
TextFlow to finish rendering, the scroll bars got adjusted
properly, and it was ready to accept input with the blinking
cursor.
Here is a dump from some trace statements I have in my code,
I'm trying to work out the order in which events are happening and
when the text flow gets proper measurements:
Composer -> Resize -> New TextFlow Dimensions -> W:
0 H: 0
Composer -> Creating Display Controller -> TextFlow
Dimensions -> W: 754 H: 0
Composer -> Created
MessageEditorBase -> Created
MessageEditorBase -> Event Fired -> Resize
MessageEditorBase -> Event Fired -> Show
Composer -> Resize -> New TextFlow Dimensions -> W:
754 H: 0
MessageEditorBase -> Event Fired -> Resize
Composer -> Resize -> New TextFlow Dimensions -> W:
1328 H: 274
MessageEditorBase -> Event Fired -> Resize
Composer -> Resize -> New TextFlow Dimensions -> W:
1328 H: 275
MessageEditorBase -> Event Fired -> Resize
Composer -> Resize -> New TextFlow Dimensions -> W:
1329 H: 276
MessageEditorBase -> Event Fired -> Resize
Composer -> Resize -> New TextFlow Dimensions -> W:
1334 H: 277
MessageEditorBase -> Event Fired -> Resize
Composer -> Resize -> New TextFlow Dimensions -> W:
1350 H: 279
"MessageEditorBase" is a canvas (used as a tab) that gets
displayed to the user. Within that Canvas are lots of components
including the "Composer" which is basically a toolbar of elegant
buttons and format functions, and then a blank canvas which holds a
UIComponent and becomes the DisplayObjectController. Works great in
my other app, the code is nearly line for line with Adobe's
examples.
Notice how it starts 0,0; then gets a width measurement of
754; finally when I the user resize the entire application do the
rest of the proper dimensions get computed.
I don't think it's a TextFlow problem, but I can't say I
understand the Flex rendering hierarchy enough to have implemented
TextFlow and its controller in the right way with this app.
Any thoughts? If you need more information just ask and I'll
try to explain as best as possible.As it turns out with a lot of fiddling and trace statements,
I figured out a way to initialize the DisplayObjectController with
valid pixel values. In your TLF examples, the developers always
created a display object controller using specific dimensions, like
250 x 250. But I need my text component to be created dynamically
based on the screen size of the user. This was not happening
correctly after I upgraded to TLF build 370, though it's not even a
TLF problem.
I took the measurements from the parent canvas. For whatever
strange reason, in the world of measuring Flex components, the
child canvas further down in the application, the one that I added
the sprite to, was not getting measured out correctly. Thus when I
passed the controller width and height values from this child, they
were 0.
I hope that made sense, but either way, problem fixed.
Edit:
Here's an example of my code using a custom controller that
had the keyDown event overriden:
theController = new
ComposerDisplayController(uiFlowComponent, uiTextArea.width,
uiTextArea.height, this);
I passed values which I expected the UI to measure out rather
than me providing explicit pixel values. I had a problem when the
UI gave me zero. -
TextFlow height and Flex SDK 3.5
Hello, forum
Thank you very much for the possibility to use TextFlow in Flex 3. I'm using the technique as Mihai Corlan by doing the following thing:
There is a TextFlow instance and a ParagraphElement added to it.
var p : ParagraphElement = new ParagraphElement();
span.text = 'Disc VERBATIM DVD+RWs 4x Jewel Case 5';
p.addChild(span);
_textFlow.addChild(p);
The TextContainer is a Sprite and it is added as canvLabel.rawChildren.addChild(_textContainer); into the Flex Canvas.
<mx:Canvas id="canvLabel" height="80" width="100%" >
</mx:Canvas>
What I am trying to implement is to resize the Canvas automatically to fit the TextFlow. How can this be done?
How can I define the height of the TextFlow that was put into my Canvas and automatically detect the correct height for the Canvas?
If I set the Canvas height to 100% nothing is showed. I guess in Gumbo the Container is automatically resized due to TextFlow's height but how this can be implemented in Flex 3.5 ?
Thanks in advance,
Mikhail ShevchukWell, I can build a textcontainer as a UIComponent, but how can I detect width and height of the TextFlow so I can set appropriate size in measure() method of that UIComponent.
I guess this code should be implemented then in createChildren():
_textFlow.flowComposer.addController(new ContainerController(_textContainer, canvLabel.width, canvLabel.height));
_textContainer will be replaced with 'this', canvLabel.width with this.width, canvLabel.height with height, but how I set the correct size in this UIComponent?
Thanks in advance,
Mikhail -
How can I test a UIComponent to see if it is user editable?
My current code now loops through the children of a container
and adds
an event handler to each one to listen for a "change" event.
However, I want to only add event handlers to UIComponents
that have
some sort of value that the user can change.
Some examples of these components are: TextInput, ComboBox,
RadioButton, CheckBox, ColorPicker, List, RichTextEditor,
etc.
My current code is something like this: (simplified)
var component:UIComponent = container.getChildAt(i);
if (component is Container)
// add event handlers to the container's children
else if (component is UIComponent && "enabled" in
component)
// add an event handler to component
Unfortunately, this doesn't work for all the various input
controls.
e.g. The RichTextEditor is a Container, so the code tries
adding event
handlers to it's children (I want an event handler on the
actual
RichTextEditor).
Is there a reliable way of detecting a user editable control?
Thanks in advance!To test a form before deploying it, you use the Test tab. In the Test tab you will find the Test Web Form button. Clicking this button will open up a new Browser tab/window with your form. You will be able to see what the form will look like and how all of the fields work. If you wish to verify that submit works, you will need to Open your form in the Distribute tab. For the uploading of an image you will need to use the file attachment tool. The pasting of an image is not supported.
Jeff Canepa
Software Quality Engineer
Adobe Systems, Inc.
[email protected] -
Putting a UIComponent within a Canvas using AS3
Hello,
I am brand new to Flex 3 (using it about 3 days). I have
written code that almost works the way I need it to.
The main problem I have is that I am trying to use
ActionScript to embed an image in a Accordion Canvas area.
I can create the image dynamically but the UIComponent I
added the image to is getting placed outside the Canvas
and outside the Accordion component. I am passing a url to
get the image file in the image variable and that works
ok. I need to get the image/uicomponent inside/on the Canvas
with AS3. See attached code snippet. I am taking
this learning one step at a time and need this knowledge.
Thanks so much for your assistance with issue.
Kim H.The coding below is almost identical and the setStyle methods
did not affect the results in any way. There has to be
something in
AS3 that will embed the UIComponents in the Canvas. the x and
y
properties of the UIComponent are also shift my appliction
down the screen
which is weird to see.
Please help me to understand what I need to do.
Kim H.
[email protected] -
Accessing the 'text' in a TextFlow instance?
How do I actually access the textual content of a TextFlow object?
When there is a single SpanElement in the TextFlow then I am able to use ...
mySpan.text
But if I have added multiple SpanElements to the ParagraphElement then how do I get the entire textual content so that I can store it in a String variable.
I am also having problems accessing the entire text when the user has pasted in to an editable field, I presume this is because of multiple SpanElements being created.
Is there anything that is the equivalent to the old ...
myTextField.text
Thanks in advance,
AdrianHi Alan,
Thank you so much for your help!!!
Just for the record, here is a working example ...
import flashx.textLayout.container.*;
import flashx.textLayout.elements.*;
import flashx.textLayout.edit.*;
var config:Configuration = new Configuration();
config.manageEnterKey = false;
var textFlow:TextFlow = new TextFlow(config);
var para:ParagraphElement = new ParagraphElement();
var span1:SpanElement = new SpanElement();
span1.text = "Hello ";
span1.fontSize = 12;
var span2:SpanElement = new SpanElement();
span2.text = "World";
span2.fontSize = 16;
para.addChild(span1);
para.addChild(span2);
textFlow.addChild(para);
var cc:ContainerController = new ContainerController(this, 550, 400);
textFlow.flowComposer.addController(cc);
textFlow.flowComposer.updateAllControllers();
trace("textFlow.numChildren:"+textFlow.numChildren);
// OUTPUT: 1
trace("para.numChildren:"+para.numChildren);
// OUTPUT: 2
trace("textFlow.getText():"+textFlow.getText());
// OUTPUT: Hello World -
Creating a bitmap copy of a TextFlow object without the caret [cursor]
Hey all
I'm currently working on creating a bitmap copy of a TextFlow object and I am looking at hiding the caret. What would be the best way forward, using the focusmanager to 'unfocus' the TextFlow object, or is there some more direct approach available? I know there is a cursormanager in Flex, but this is an AS3 only project.
Cheers for your thoughts once again
emdI think I've just done something similar to what you need (except I'm adjusting the width of the bitmap according to that of the text), and so far I have seen no cursor
Here's the code. You'll need to adjust it depending on how many containers (Sprites) you are drawing the TextFlow to.
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
applicationComplete="init()">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:Group id="groupText" width="560" />
<fx:Script>
<![CDATA[
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.conversion.TextConverter;
import flashx.textLayout.elements.TextFlow;
import mx.core.UIComponent;
private function init() : void
var text : String = "Greek god gives mints.";
var fontSize : int = 24;
//We create a textflow with some text and set it's font size, just as an example.
var flow : TextFlow = TextConverter.importToFlow(text, TextConverter.PLAIN_TEXT_FORMAT);
flow.fontSize = 24;
//We'll use a single container (and consecuently a single controller)
var container : Sprite = new Sprite()
var controller : ContainerController = new ContainerController(container);
flow.flowComposer.addController(controller);
//This is kind of weird, but I saw it in a TLF example, and it works.
//It seems you have to "stretch" the container.
controller.setCompositionSize(this.stage.stageWidth, this.stage.stageHeight);
flow.flowComposer.compose();
//Set the text's actual width and height as the composition size.
controller.setCompositionSize(controller.getContentBounds().width,
controller.getContentBounds().height);
//Redraw.
flow.flowComposer.updateAllControllers();
//As BitmapData's draw method takes an IBitmapDrawable,
//we'll need to wrap the Sprite instance in an UIComponent.
var tf : UIComponent = new UIComponent();
tf.addChild(container);
//Create an instance of BitmapData and "draw the container" into it.
var bd : BitmapData = new BitmapData(controller.getContentBounds().width,
controller.getContentBounds().height + 2, true, 0x000000);
bd.draw(tf);
//Create a Bitmap with the text's data and add it to the application.
var bmp : Bitmap = new Bitmap(bd);
var ui : UIComponent = new UIComponent();
ui.addChild(bmp);
this.groupText.addElement(ui);
]]>
</fx:Script>
</s:Application>
Hope it helps,
Sebastián. -
Adding objects to the stage & acceessing stage properties - I'm a bit confused..
Hi,
I'm a little confused on two fronts regarding display
programming:
A. What the best way to add objects to the stage?
B. How to access stage properties.
I can do both of these when the project is an 'Action Script
Project', but I'm having trouble when it is a 'Flex Project' (e.g.
an MXML file). See the two attached files with questions included
in the comment to see exactly what I mean.
A. What the best way to add objects to the stage?
=====================================
In an action script project that extends Sprite I can just
call addChild()
In an MXML project I can add objects to the stage by first
adding them to a UIComponent, then adding that to the stage.
1. Is that the best way to do it?
In this doc:
http://livedocs.adobe.com/flex/3/html/help.html?content=05_Display_Programming_02.html
it says that
quote:
Each SWF file has an associated ActionScript class, known as
the main class of the SWF file. When Flash Player opens a SWF file
in an HTML page, Flash Player calls the constructor function for
that class and the instance that is created (which is always a type
of display object) is added as a child of the Stage object. The
main class of a SWF file always extends the Sprite class
2. why cant I just add a sprite object direct to the stage
without the UIComponent?
3. What is the 'main class', and how can i get access to it?
B. How to access stage properties.
=========================
In an action script project that extends Sprite I can just
call trace(stage.framerate)
But in an MXML file I cannot figure out how to access the
stage properties.
See the attached code for the things that I tried, but which
didnt work.
In the page:
http://www.actionscript.org/forums/showthread.php3?t=140655
It says
quote:
For stage access you have a couple of rules:
* natively, only display objects have inherent access to
stage
* display objects only have a valid reference to stage if
they're within the stage's display list (on the screen, after added
to it with addChild)
* The only display objects which immediately have access to
the stage before the use of addChild (in their constructor) are the
document/application class instance (root) and any instance from
the library placed on the timeline (not created with AS).
* Non-display object classes have to be passed or assigned a
reference to the stage from another object which already has access
to it - they cannot access it otherwise.
4. How do I access the stage properties in the MXML project?
5. I suspect this is related to the "main class", which I
dont yet understand - is it?
Sorry for the long post.
cheers
tom"tom saffell" <[email protected]> wrote in
message
news:gd7cm9$d1v$[email protected]..
> Thanks Luigi - that helps a lot.
> I hadnt seen the Flex 3 Developer Guide before - it's
very useful.
>
> I now see that I can access properties of the
application object directly
> with
> this.<property>.
> However, the framerate property cannot be set by
actionscript, only in
> MXML (I
> can set it in the <mx:application> tag). But I
need to be able to set it
> programatically, dependent on user input.
>
> 5. Is there a way around this?
> 6. Can I set the stage's framerate to achieve the same
outcome?
>
> I still dont understand why I cannot access the stage
object. When I call
> either
this.stage or
uic.stage * then I get
quote:
Cannot access
> a
> property or method of a null object reference.
My understanding is
> that I
> can access the stage object via any display object on
the display list.
> I'm
> confused about this bit..
>
> * - uic is a UIComponent that has been added to the
display list (i think)
> by
> calling addChild(uic) from the AS3 within the
application
>
> 7. How do I access stage properties in AS3 in an MXML
project?
http://www.adobe.com/livedocs/flex/3/html/help.html?content=05_Display_Programming_10.html
It seems like possibly your real problem is that you're
having trouble
searching the Help effectively:
http://flexdiary.blogspot.com/2008/07/getting-help-in-flex-builder.html -
UIComponent changes cause many updateDisplayList calls
I'm currently experiencing a bug when using the Flex 4 beta 1 SDK with regards to some UIComponent changes that have been made.
There have been overrides added for many transformation properties in UIComponent, for example "rotationY". Now when I want to animate this property to rotate a component in 3D, it results in a call to invalidateDisplayList in the parent every single frame, and fails to render my view as it rotates, due to the fact it fails to update the screen at all because it appears to call invalidateDisplayList all the way up the visual hierachy so you don't even see rollovers on standard button controls when you mouse over.
Below is some very simplified code that uses the Halo components. This code may look obtuse, but it's designed to mirror my real situation, which is more complex, however it still illustrates the problem.
1. When I compile this with Flex SDK 3.4, I get 1 single trace of "updateDisplayList", and it animates smoothly.
2. When I compile this with Flex SDK 4 beta 1, I get a trace of "updateDisplayList" every single frame*.
* As you can imagine, in this simple scenario it's not a big problem, but when you consider I'm rotating a fairly complex UI/view, it completely falls over when compiling with Flex 4 as the CPU cannot handle the chain of invalidatations.
I'm trying to figure out whether this is expected behavior. I can't see how I can rotate my view when I switch to compiling with Flex SDK 4?
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init();">
<mx:Script>
<![CDATA[
import mx.controls.Button;
import mx.core.UIComponent;
private function init():void
var outer:UIComponent = new UIComponent();
var inner:UIComponent = new UIComponent();
var button:Button = new Button();
button.label = "Hello World";
button.width = 100;
button.height = 50;
inner.addChild(button);
outer.addChild(inner);
addChild(outer);
addEventListener(Event.ENTER_FRAME, function(event:Event):void { outer.rotationY++; });
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
super.updateDisplayList(unscaledWidth, unscaledHeight);
trace("updateDisplayList");
]]>
</mx:Script>
</mx:Application>
Many thanks,
RichardHi again,
Thanks for this detailed explanation, it really helps clear up some of
these migration questions, particularly when combining Halo components
with the new improved Spark model.
After posting I continued digging and found Rotate3D working as
expected and began to look through the postLayout Transform stuff but
didn't quite grasp the entire flow yet. But of course your post
describes exactly the situation, I think it'd make for a useful devnet
article perhaps for people moving from Flex 3 to 4 like myself.
Could at least be a quick blog post
Note that the behavior on the 3d effects that determines whether they set the layout or postLayout properties is governed by the effect property applyChangesPostLayout. This flag is true by default for the 3D effects, but false by default for the 2D transform effects (Move, Scale, Rotate).
So if my component extends UIComponent, and previously I would have
tweened rotationY, perhaps now I can run a tween and call
transformAround() instead (or just use Rotate3D) in order to make use
of the postLayoutTransformOffsets mentioned?
Correct, although I think you'd be better served by just using Rotate3D and letting us figure out the details of transforming around the specified point (center by default, but specifiable if you want to rotate around a different point). At their core, the effect simply animate properties. But in the case of transform effects, they do a lot more to figure out the transform center and call transformAround() appropriately, and also combine in useful ways with other transform effects running in parallel to avoid some of the effect-fighting artifacts of previous versions.
So use Rotate3D (and the other effects) when you can. Or use Animate if you're just doing raw property rotation. And if you have to go to the level of Animation to animate properties, please let us know why (what in the effects classes didn't suit your purpose?). Animation is certainly there to be used, but it's probably not something that developers would typically call directly.
I'm just a little worried about migrating projects where these sort of
things that worked in Flex 3 would cause the recursive layout calls
experienced. I am using compatibility-version=3 so perhaps a clause
could be inserted to ignore the new transform changes in UIComponent
for backwards compatibility in these cases until the developer can make
the necessary changes in all places?
Not sure how embedded that logic is, but layout code is pretty extensive, so it might not be trivial to make that change. I'll forward the request...
Like many people no doubt, I'm planning to migrate projects when
possible in order to make use of new features and improved programming
model, for example I'm using some Flex 4 SWCs (the TLF ones), and plan
to port to Spark as and when components are available.
Excellent. Let us know when you run into issues.
Thanks,
Chet.
Thanks again,
Richard
> -
Do embedded fonts work in TextFlow yet?
Embedded fonts aren't working for me in TextFlow for SDK build 8537. I added the embedAsCFF: true thing, and the font does show up in Spark controls; it's just not working when I use it in TextFlow (defaults to Times). Non-embedded fonts are working fine though in TextFlow, the problem is only with the embedded ones. Is this a known issue at this time?
Turns out this is because of the linkage setting to RSLs in the newer SDK builds, Adobe is looking at this. Check outhttp://forums.adobe.com/message/2121775#2121775 for details/workaround.
-
Spark Combo instantiation overriding TextFlow default configuration
I've posted this also on the Text Layout Framework forum here : http://forums.adobe.com/message/2686329#2686329
I have a textFlow running through columns with a nice embedded font. Looks lovely. I then decide to add a completely unrelated Combo box to my app ... and now the textFlow doesn't render with the font. Comment out the combo and the font returns.
I ran some tests and even with a completely dumb combo added with no DP it robs me of my font.
Here's the code I have for my TextFlow : http://snipplr.com/view/30192/programmatically-creating-a-textflow-stream-of-link-elements /
Notice the formatting for the TextFlow object is created with a Configuration object. I believe this is being overriden by the Combo.
I'm going to try and create a non-config format and see if that solves it. Any ideas?I've had the same odd experience. For instance, if I set a style using MyTextArea.setStyle("fontSize", 56) and export it to HTML the font tag will say size="12" but it will show as 56px when drawn in the browser. Very weird.
But that's not the real problem with the TextConverter.export method, the real problem is that it surrounds every paragraph with a font tag, even though I have also done so through using TextLayoutFormat for the entire paragraph's range. On export I end up with two font tags around every paragraph, the one the TextConverter adds and (inside of that, luckily) the one that I have set.
Now I have to write custom code that goes back through all the paragraphs and "breaks" them out of the extra font tag...which is entirely unnecessary.
I hope this gets fixed in the future. Perhaps like this: TextConvert.export(source, format, conversionType, *addHtmlTags:Boolean*);
Maybe you are looking for
-
dear sir i check with abaper ,he says the value is updated from sale order they get the consumption of sales using customized transaction actual cost is zero user create the material master withot pricing we ask to update the material master and they
-
How to allocate a text value to a null field in a cross tab
Hi there, I'm using Crystal 2008 and have created a report that retrieves support tickets assigned by team within a specific date field. I've added a cross tab that is retrieving the data correctly. However, if the team field is blank, the cross tab
-
Windows 7: Trust Relationship Error - Local Administrator Account Locked.
I have 2 Windows 7 Professional machines that recently locked me out citing the "Trust Relationship between this workstation and primary domain failed". I assumed all I would have to do is log in as local administrator and remove it from the domain
-
Copy/paste 23.976 timeline to 24 timeline leaves gaps in edits
Premiere 5.0.3 Windows 7 R3D Footage 23.976 Thanks in advance for any ideas/help. (The reason for me doing this is explained below) Here is what I am doing 1) Edited scene on 4k 23.976fps timeline 2) Selected all the edits and copied them 3) Created
-
Pre-ordered available song won't appear in purchased in iTunes?
I pre-ordered One Direction's new album Four, and have received all of the available songs except one, which was the first to be released other than "Steal my Girl", titled "ready to run". It states that I have pre-ordered the song, but will not show