Using Linkbar objects and EventListeners

The code:
Note, I left out most object specific details, like width and
height etc...
var pl:Panel = new Panel();
var lb:LinkBar = new LinkBar();
lb.addEventListener(MouseEvent.CLICK, httprequestObject);
var vs:ViewStack = new ViewStack();
var cv:Canvas = new Canvas();
cv.label = "navigation button";
vs.addChild(cv);
lb.dataProvider = vs;
pl.addChild(lb);
this.addChild(pl);
public function httprequestObject(e:MouseEvent):void{
Alert.show("success!");
For whatever reason this doesn't work. Suggestions,
thoughts.

Actually here is the complete code incase anyone is
interested in trying it...
<?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.containers.Canvas;
import mx.containers.ViewStack;
import mx.controls.LinkBar;
import mx.containers.Panel;
import mx.controls.Alert;
public function init():void{
var pl:Panel = new Panel();
pl.width = 200;
pl.height = 200;
var lb:LinkBar = new LinkBar();
lb.percentWidth = 100;
lb.addEventListener(MouseEvent.CLICK, httprequestObject);
var vs:ViewStack = new ViewStack();
vs.percentWidth = 100;
var cv:Canvas = new Canvas();
cv.percentWidth = 100;
cv.label = "navigation button";
pl.addChild(lb);
lb.dataProvider = vs;
vs.addChild(cv);
addChild(pl);
public function httprequestObject(e:MouseEvent):void{
Alert.show("success!");
]]>
</mx:Script>
</mx:Application>

Similar Messages

  • Using jpegEncoder object and filesystem

    Hi, I also posted this in the Flex general forum, but it
    seems to be more AIR related since it deals with saving to the
    local disk. I am trying to create a simple AIR application that
    creates a thumbnail from an image component and saves it as a jpeg
    to the desktop. I am not sure where I am going wrong here, but the
    file is corrupt and no information is being written to it. If I
    look at the content (via the "more" command on the command line) it
    is 8 blank lines.
    Thanks so much,
    Jed
    =========
    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="vertical">
    <mx:Script>
    <![CDATA[
    import mx.graphics.ImageSnapshot;
    import mx.graphics.codec.*;
    import mx.events.FileEvent;
    private function captureImg():void{
    //captures the image as a jpg and saves it to the desktop
    var codec:JPEGEncoder = new JPEGEncoder();
    //var ba:ByteArray = new ByteArray;
    var file:File =
    File.desktopDirectory.resolvePath("test.jpg");
    var filestream:FileStream = new FileStream;
    var snapShot:ImageSnapshot = new ImageSnapshot;
    snapShot = ImageSnapshot.captureImage(bigImg,72,codec);
    filestream.open(file, FileMode.WRITE);
    filestream.writeBytes(
    codec.encodeByteArray(snapShot.data,420,120),0,snapShot.data.length);
    filestream.close();
    private function makeSmall():void{
    //makes the image on the screen thumbnail size
    var pic:Image = bigImg;
    pic.setActualSize(420, 120);
    ]]>
    </mx:Script>
    <mx:VBox horizontalAlign="center" verticalAlign="top">
    <mx:Image id="bigImg" width="480" height="320"
    source="orignial/test2.jpg"/>
    <mx:Button label="Reduce Size" id="btnSmaller"
    click="makeSmall();" />
    <mx:Button label="Snap Thumbnail" id="btnThumbnail"
    click="captureImg();"/>
    </mx:VBox>
    </mx:WindowedApplication>
    Text

    Well I didn't get any feedback here on this problem. But I
    did figure it out.
    ===============
    <mx:WindowedApplication xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="vertical">
    <mx:Script>
    <![CDATA[
    import flash.display.BitmapData;
    import mx.graphics.codec.JPEGEncoder;
    import flash.filesystem.*;
    private function captureImg():void{
    ** A bitmapData object is needed to contain the visual data
    var bmpd:BitmapData = new BitmapData(
    smallImg.width,smallImg.height, false, 0xFFFFFF);
    bmpd.draw(smallImg);
    ** the bitmapdata object needs to be encoded into an
    byteArray with
    ** the JPEGEncoder. there is also a PNGEncoder for .png
    files if wanted
    ** The paramerter passed is the quality of jpeg we are
    encoding, 50 - 100.
    var jpegEnc:JPEGEncoder = new JPEGEncoder(80);
    var ba:ByteArray = jpegEnc.encode(bmpd);
    ** Then we need to take the byteArray and save it to disk.
    ** this requries using a File and fileStream object. The try
    block
    ** catches the end of file error.
    var file:File =
    new
    File("file:///Developer/Flex/thumbnailDemo/src/thumbnail/thumb1.jpg");
    var filestream:FileStream = new FileStream();
    try{
    filestream.open(file, FileMode.WRITE);
    filestream.writeBytes(ba);
    filestream.close();
    }catch (e:Error){
    trace(e.message);
    filePath.text = file.name + " has been saved to " +
    file.nativePath;
    filePath.enabled = true;
    ** makeSmall reduces the size of the main image and places
    it in
    ** the smallImg component to await capture
    private function makeSmall():void{
    //makes the image on the screen thumbnail size
    var pic:Image = bigImg;
    var otherPic:Image = smallImg;
    smallImg.source = bigImg.source;
    otherPic.setActualSize(120, 80);
    ** loadThumb loads the saved thumbnail to the savedPic
    component
    private function loadThumb():void{
    var thumb:File =
    new
    File("file:///Developer/Flex/thumbnailDemo/src/thumbnail/thumb1.jpg");
    if (thumb.exists){
    var src:File = new
    File("file:///Developer/Flex/thumbnailDemo/src/");
    var relPath:String = src.getRelativePath(thumb);
    savedPic.source = relPath;
    filePath.text = "The Thumbnail has been sucessfully loaded
    from "
    + thumb.nativePath;
    ]]>
    </mx:Script>
    <mx:VBox horizontalAlign="left" verticalAlign="top">
    <mx:HBox>
    <mx:Image id="bigImg" width="480" height="320"
    source="orignial/test2.jpg"/>
    <mx:VBox verticalAlign="top" horizontalAlign="center">
    <mx:Label text="Thumbnail"/>
    <mx:Image id="smallImg" width="120" height="80" />
    <mx:Label text="Saved Thumbnail" />
    <mx:Image id="savedPic" width="120" height="80" />
    </mx:VBox>
    </mx:HBox>
    <mx:HBox horizontalAlign="left">
    <mx:Button label="Reduce Size" id="btnSmaller"
    click="makeSmall();" />
    <mx:Button label="Snap Thumbnail" id="btnThumbnail"
    click="captureImg();"/>
    <mx:Button label="Load Thumbnail" id="btnLoad"
    click="loadThumb();"/>
    </mx:HBox>
    <mx:Label id="filePath" enabled="false" />
    </mx:VBox>
    </mx:WindowedApplication>

  • Display icon using MIME Objects and BSP Tags on Pop up

    HI all,
    My requirement is to add the warning icon in my pop up along with the text..
    I accomplished this using the warning message
    DATA: lr_msg_service TYPE REF TO cl_bsp_wd_message_service, lr_msg_service ?= view_manager->get_message_service( ). lr_msg_service->add_message( iv_msg_type = 'W' iv_msg_id = '000' iv_msg_number = '007' ).
    But i wish to know the other way to accomplish this using the Mime Objects..
    Can any one pls lemme know how do i achieve this using the Mime Objects + BSP HTML Tag.
    Kindly help !!

    If it doesn't work with a custom theme then the theme makers didn't include that icon in its theme. You can contact the creators of those themes and inform them about that.
    You can re-enable the sliding info bar at the top of the browser.
    You can look at these prefs on the about:config page and reset them via the right-click context menu:<br />
    Info bar at the top: privacy.popups.showBrowserMessage<br />
    Status bar icon: browser.popups.showPopupBlocker<br />

  • Reading colour image using raster object and getsample() method

    Hello all,
    I am trying to read a grey image using this code below and it perfectly works:
    File filename = new File("myimage.jpg");
    BufferedImage inputimage = ImageIO.read(filename);
    Raster input = inputimage.getRaster();
    double pixelvalue = input.getSample(xx, yy, 0) ; // to read pixel colour.
    Now:
    what modifications should i do to read a colour image using getsample() method.
    any help, by example if y would.
    Thanks

    The code below
    double pixelvalue = input.getSample(xx, yy, 0) ; // to read pixel colour.actually doesn't obtain the pixel color. It reads a band of the specified pixel. If you are reading a tripple band image (24-bit colored image RGB ) then you have to invoke this method three times for band 0, 1 and 2. The arrangment of them depends on the BufferedImage type.
    In reply of your question, you can use getSamples method, refer to the java API documentation of the BufferedImage class for more info.
    you can also check methods getRGB and setRGB, they used to get/set the entire pixel in range of 0x00000000 to 0x00FFFFFF ( 0x00RRGGBB of image type TYPE_INT_RGB )
    Regards,
    Mohammed M Saleem

  • Grid design element to cover page using circle objects and the align toolbox.

    Hi all,
    I'm currently working through a tutorial in which I need to cover the entire page with a grid of evenly spaced small circles. The tutorial tells me to copy and paste the initial circle then align left and vertical, and repeat for horizontal. However what I'm left with are just two rows of circles, one down the far left and one across the top of the page.
    What is the best way of covering the entire page with these circles so that they are identical and evenly spaced across the page?
    Thank you!!

    If i understand correctly, how a bout Edit>step and repeat and turn on create as a grid

  • Tidying up objects and listeners (basic)

    A newbie wannabe-AS3 question. My difficulty is (I think)
    removing unwanted objects and listeners as I move from one mode to
    another in my project ... altho my difficulty behind that is
    probably inadequate understanding of Display List basics.
    In one 'mode' of my project I have generated the following
    structure:
    1.... Sprite ("reviewPage");
    2a......... Some graphics on reviewPage
    2b......... TextField ("commentBox");
    2c......... A number of Sprites ("displayCard_1",
    "displayCard_2", ... "displayCard_n");
    3a............. Some graphics on each displayCard;
    3b............. Several EventListeners on each displayCard
    (e.g. displayCard.addEventListener(MouseEvent.CLICK,
    gotoReviseCardMode, false, 0, true))
    3c............. TextField ("questionBox_1" ...
    "questionBox_n");
    3d............. TextField ("equationBox_1" ...
    "equationBox_n");
    3e............. TextField ("answerBox_1" ... "answerBox_n").
    One of the eventListeners attached to each displayCard Sprite
    calls a function intended to tidy-up the unwanted objects and
    eventListeners and then shift the activity to a different mode,
    defined by another function.
    There is only one child on the stage. I assume this will be
    my reviewPage with all the objects it holds. However when I trace
    it, and it's name, I get "root1 [object MainTimeline]". Using
    stage.removeChildAt(0) removes all the visible objects from the
    Display List and leaves me with no children on the stage.
    I've tried to 'explore' my structure by writing a small
    function to identify each object/container and the hierarchy of
    objects attached to them ... but have as yet been spectacularly
    unsuccessful in that effort and overwhelmed with error messages.
    I have a couple of concerns / questions:
    1. Do I remove all the eventListeners when I
    stage.removeChildAt(0)?
    2. Do I still need to remove these objects from memory? If
    so, how? How can I explore what listeners and objects are using
    memory after I've attempted a clean-up like this?
    3. How do I remove just one of the TextField objects, say
    answerBox_212, or one of the eventListeners attached to one of the
    "displayCard" Sprites, from the Display List and/or from memory?
    Any guidance would be greatly appreciated.
    Cheers
    Dougal

    Hi John,
    Many thanks for your reply, where can I find out what the default setting is? In the style sheet, margin is set to 0. Do you mean the  <p> </p> on the first line of text? The code for that section is below, do I not need the <p> </p>?
    <h6>Heding 1</h6>
        <p>An image placeholder was used in this layout in the .header where you'll likely want to place  a logo. It is recommended that you remove the placeholder and replace it with your own linked logo. </p>
        <h3>Logo Replacement</h3>
        <p> Be aware that if you use the Property inspector to navigate to your logo image using the SRC field (instead of removing and replacing the placeholder), you should remove the inline background and display properties. These inline styles are only used to make the logo placeholder show up in browsers for demonstration purposes. </p>
        <p>To remove the inline styles, make sure your CSS Styles panel is set to Current. Select the image, and in the Properties pane of the CSS Styles panel, right click and delete the display and background properties. (Of course, you can always go directly into the code and delete the inline styles from the image or placeholder there.)</p>
    Many thanks for your help.
    Regards
    Nick

  • Abap objects and alv

    using abap objects and alv  There should be  push button (Switch drill down button) at the top of the report. While pressing Switch drill down button it should display a popup window like
    material
    material gorup
    plant
    For example if a material group is selected, the report should be displayed with respect to material group.
    For example if it is Plant, the report should be displayed with respect to Plant.
    Standard Drill down should be first with respect to material it should be displayed…after clicking it with respect to vendor it should be displayed…after that w.r.t month.
    There should be  push button ( topno button) at the top of the report.
    you have to choose a key figure field and press topno.if  PO value is chosen and if you press topno and give value as 3,the top three po value should be displayed.
    Totals for Po value, order quantity and GR quantity should be displayed..
    please, can anybody send me the code for above criteria immediatly.

    Go through the Standard programs.. BCALV_GRID_*
    BCALV_GRID_05 suits ur req.
    Regards
    Bhavani

  • Updating User field with ListItemFormUpdateValue object and ValidateUpdateListItem for a file metadata

    Hi Every body,
    Please this is very argent I'm searching for this problem sine a week with no success
    how can I update a user field (single and multi) using ListItemFormUpdateValue object and ValidateUpdateListItem method
    Thanks in Advance
    khatib7

    Hi,
    Seems there are already replies in your another similar thread about this issue:
    https://social.technet.microsoft.com/Forums/en-US/5e67dc3d-c808-49ee-9aab-383a5cea5bce/sharepoint-angulr-rest-api-update-file-item-userd-field-property?forum=sharepointdevelopment
    Please check whether they are helpful to you.
    Thanks 
    Patrick Liang
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • BOR Object and ABAP Class

    Hi,
        Can anybody say when to use BOR object and Abap class in the task with an example.
    Thanks,
    Mugundhan

    There is no any specific condition or rule that for this purpose you need to use BOR and Class , it depends on your requirement. not only the requirement but also the new techniques to make classes not just as simple way to create objects but when you use classes in the Workflows they are not simple classes but they are BUSINESS CLASSES which makes a lot of difference.
    Check the blogs of [Jocelyn Dart|https://www.sdn.sap.com/irj/scn/wiki?path=/pages/viewpage.action%3fpageid=55566]

  • Business objects and start events required for CO11N and CO13 transactions

    Hi,
    We do production order <b>confirmation</b> and <b>cancellation</b> in CO11N and CO13 respectively. Can somebody please tell me the corresponsing business objects and the start events for them? This is a very urgent issue, I will surely rewad good points.
    I guess we need to use AFVC_PM object and "finalconfirmation" event for the confirmation.
    Please confirm this and kindly suggest the same for cancellation.
    Thanks,
    Max

    Hi Max,
    You will have to use the object BUS2005 - which is for Production order.
    If you do not have Required events in the BO, you will have to extend object to add those custom events e.g. Cancellation event.
    In this case you wil have to use Status management technique for raising events if standad transaction is not raising them.
    Hope following SAP Help link might help you  to start off..
    http://help.sap.com/saphelp_47x200/helpdata/en/c5/e4aed5453d11d189430000e829fbbd/content.htm
    Regards,
    Akshay Bhagwat

  • Why use smart objects

    Been away from photoshop since early days of CS6. At that time I did not use smart objects. Now I see many tutorials using smart objects and smart filters. Is the use of smart objects in the mainstream now? Reasons for and against using them.

    Smart Objects are a very good thing!
    Photoshop Help | Work with Smart Objects
    "Smart Object are layers that contain image data from raster or vector images, such as Photoshop or Illustrator files. Smart Objects preserve an image’s source content with all its original characteristics, enabling you to perform nondestructive editing to the layer."
    I can't think of reasons NOT to use them.
    Nancy O.

  • Business objects and event type linkages...

    Hi Experts,
    Im a bit confused with business objects (swo1) and event type linkages(swetypv). Ive learned that business objects are used to trigger events and so how does event type linkages related to business object? Do I need to create business object or should I just search/look for the appropriate object needed?Please kindly explain to me the process or steps in using business object and event type linkages in related with idocs.

    Hi,
    Business objects neednot have to be created if your are fine with the standard method they have used in or the events yre available for you. If you need to cusomize it then you have to copy it to a subtype. Then do your modifications in it. Event type linkages are used to say which event is active for a Workflow. And if you want to trigger a Workflow based on certain conditions then you have to use either this or Start of Condition. The Error handling of workflow is also handled by Event Type Linkage. So whenvever you create a event linkage for a workflow you get an entry in Event Type Linkage.
    Hope this would have thrown some light on you.
    Thanks,
    Prashanth

  • Managing Entity Object and PL/SQL transactions

    Hi,
    I have requirement to use entity objects and PL/SQL API in the same transaction.
    First the data is created in the entity object and then API is called to do some validations on the data created through entity object.
    I am not able to fetch the rows created by the entity object in the PL/SQL API until I issue a commit before calling the API.
    Can anyone suggest me how to get the data in PL/SQL API which was created by the entity object without commit. As I want to have a commit only after API returns true.
    Thanks in advance

    Override the beforeCommit method of the main entity object of your page.
    The commit will only take place if the PLSQL does not throw any errors.
    See example below:
    public void beforeCommit(oracle.jbo.server.TransactionEvent e) {
    methodToCheckUsingPLSQL();
    super.beforeCommit(e);
    private void methodToCheckUsingPLSQL() {
    try {
    String sql =
    "BEGIN check_my_entity(p_id => :1" +
    ", x_return_status => :2" +
    ", x_return_msg => :3); END;";
    OracleCallableStatement stmt =
    (OracleCallableStatement)getDBTransaction().createCallableStatement(sql,
    DBTransaction.DEFAULT);
    // Rebind parameters
    stmt.setNUMBER(1, getId());
    stmt.registerOutParameter(2, Types.VARCHAR); //x_return_status
    stmt.registerOutParameter(3, Types.VARCHAR); //x_return_msg
    stmt.executeUpdate();
    String returnStatus = stmt.getString(2);
    String returnMsg = stmt.getString(3);
    if (!"SUCCESS".equals(returnStatus)) {
    throw new OAException(returnMsg);
    } catch (Exception e) {
    throw new OAException("Error during methodToCheckUsingPLSQL. " +
    e.getMessage());
    Regards,
    Jeroen Kloosterman

  • Why use value objects?

    I am trying to delve a little deeper into Flex and have come across discussions about using value objects. My question is why would you use them?
    I have an application that stores records in a database using ColdFusion as a backend. Currently I use an HTTPService to call a coldfusion page that returns XML that gets put in a XMLListCollection. This is then used to populate a datagrid and form details when the datagrid item is clicked on. This all works fine and is very easy (if not very elegant, it was one of my first applications)
    I have another that uses a remote object to a coldfusion cfc. This cfc returns a query based on verious parameters. This result is then put in an ArrayCollection and used various ways.
    What is wrong with doing things this way and why/how would value objects help?
    Thanks.
    Matt

    Your example has nothing to do with value objects.
    Value objects are useful in a number of situations such as:
    1. They can efficiently represent a limited number of values. Say you have a size field with only four possible values: small, medium, large and extra large. You can use value objects and store the ordinal value (1 to 4) in a single byte instead of needing an 11 byte string. The set of value objects can be used as a white list for validating or constraining user input.
    2. You can attach other information to a value object (within reason). Say your app allows users to select from a list of colors. You can store the RGB color information in the value object for each color.
    There are probably other uses such as with strategy patterns (http://en.wikipedia.org/wiki/Strategy_pattern) as well.

  • How to set Default Mailing Address in GW8 using C3PO objects

    I am just migrating to GW8 and trying to set the default mailing address for a contact programatically using AddressBookEntry object from VB code using
    C3Po ClientState and related properties. I am using IGWAccount9 object and creating a new addressbookentry object using the AddressBookEntries.Add object. To this new object, i set a value to the DefaultMailingAddress Property. I am not thrown an exception but the value does not get set also.
    Thanks in advace for your help.
    -JP

    I am just migrating to GW8 and trying to set the default mailing address for a contact programatically using AddressBookEntry object from VB code using
    C3Po ClientState and related properties. I am using IGWAccount9 object and creating a new addressbookentry object using the AddressBookEntries.Add object. To this new object, i set a value to the DefaultMailingAddress Property. I am not thrown an exception but the value does not get set also.
    Thanks in advace for your help.
    -JP

Maybe you are looking for

  • Searchable PDF Unreadable...

    I have created two versions of a PDF. One is a serachable PDF, using IRIS and the other is a standard PDF. Why is the searchable PDF unreadable in the AR IOS version? That is, why are the pages blank? I should mention the searchable PDF is readable i

  • How to write into ldt log file in case of custom lct file

    Hi Experts, I have created one custom lct file for one of my requirement, from that I am calling database package for  UPLOAD. I want to write message into ldt log file if some validation fails. Can anyone suggest how can I write messages into ldt lo

  • Swapping A Hardrive For SSD?

    Am looking to buy a Samsung 850 pro SSD. What is the procedure for swapping all my data/drivers etc from the old drive to a new SSD? Is there a sticky somewhere?...will there be any issue with the Windows 7 licence key?

  • Sub Contracting GR Accounting Entries

    Hi All, I am posting GR for sub contracting PO and found the following entries in the accounting document of GR: 1. Stock Acct. of Finished product 2. GR/ IR Clearing Acct 3. Sub Contracting Charges 4. Change in Sub Contracting Stock However, I did n

  • Ipad 3G Locked or not

    Hello,I need help deciding if i should get an ipad with 3G, see when i select 3G there was a message saying the iPad will onnly work on the carrier i select.Problem is there is no verison or AT&T in my country im just wondering if the iPad will be "L