Multithreading in ActionScript

Hello everybody,
  We have to organise our ActionScript based extension in order to execute some time consuming operation in background. We know that we have to move to HTML5 panels, but in the meanwhile we'd like to know if is it possible to call such function in background, avoiding the UI to get freezed fore a long time. We've read about the use of workers in ActionScript 3 (http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/system/Worker.htm l), is it supported inside an extension?
Thank you.

hi,
Flash provide virtual muti-threanding since its early
versions. if you put two movieclips on stage and do mutiple tasks
in them, they will be performed at the same time.
however, you should not put for-loops on a single frame, but
break them into mutiframe operation.
you can do this in FL1.1 as well as in latest FL3.0
best,
// chall3ng3r //

Similar Messages

  • How can I convert an ActionScript 2 website to ActionScript3?

    I have a website which currently uses Action Script 2.
    When I change the Publish settings from Flash 7 to Flash 9
    and from ActionScript 2 to ActionScript 3, then publish the file, I
    get the following warning:
    WARNING: Actions on button or MovieClip instances are not
    supported in ActionScript 3.0. All scripts on object instances will
    be ignored.
    What can I do to correct this error?
    Is there a simple tutorial that explains how to make the
    changes?
    I subscribe to Lynda.com but I haven't seen useful there.
    I should warn you that I am a beginner when it comes to
    coding.
    Thank you

    Hi NickLW,
    In AS3 there's (like the error mentions) no attaching script
    to
    instances directly. You probably have something like:
    on(release){
    gotoAndPlay( 5 );
    well, atleast the "on( something )" part...
    That's a nono in AS3.
    You'd have to change it to code in a keyFrame in the timeline
    like:
    my_btn.addEventListener( MouseEvent.CLICK, onClick );
    function onClick( e:MouseEvent )
    gotoAndPlay( 5 )
    where my_btn is the instancename of the button.
    Look for migration from as2 to as3 in available resources
    (like:
    http://www.mandalatv.net/fcny/)
    Sure there's no mention on the Lynda courses?
    NickLW wrote:
    > I have a website which currently uses Action Script 2.
    > When I change the Publish settings from Flash 7 to Flash
    9 and from
    > ActionScript 2 to ActionScript 3, then publish the file,
    I get the following
    > warning:
    >
    > WARNING: Actions on button or MovieClip instances are
    not supported in
    > ActionScript 3.0. All scripts on object instances will
    be ignored.
    >
    > What can I do to correct this error?
    > Is there a simple tutorial that explains how to make the
    changes?
    > I subscribe to Lynda.com but I haven't seen useful
    there.
    > I should warn you that I am a beginner when it comes to
    coding.
    >
    > Thank you
    >
    Manno Bult
    http://www.aloft.nl

  • Can't access object using "id" or "name" if created with actionscript

    How can you register an instance of an object with actionscript so that it's id or name value is accessible?
    I included a simple example where a Button is created using mxml and in the same way it is created using actionscript.  The actionscript object is inaccessible using it's "id" and "name" property.
    <?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" minWidth="955" minHeight="600"
                   creationComplete="application1_creationCompleteHandler(event)">
        <fx:Script>
            <![CDATA[
                import mx.events.FlexEvent;
                protected function application1_creationCompleteHandler(event:FlexEvent):void
                    import spark.components.Button;
                    var asBtn:Button = new Button();
                    asBtn.label = "actionscript";
                    asBtn.x = 200;
                    asBtn.id = "asButton";
                    asBtn.name = "asButtonName";
                    addElement(asBtn);
                    trace("mxmlButton="+this["mxmlButton"].label); // returns: mxml  label
                    //trace("mxmlButton="+this["asButton"].label); // returns runtime error: ReferenceError: Error #1069: Property asButton not found on TestId and there is no default value.
                    //trace("mxmlButton="+this["asButtonName"].label); // returns runtime error: ReferenceError: Error #1069: Property asButtonName not found on TestId and there is no default value.
            ]]>
        </fx:Script>
        <s:Button
            id="mxmlButton"
            label="mxml label"
            alpha="0.8"/>
    </s:Application>

    Hi Dan,
    It is a very rare occurrence when I miss not being able to access an object (object property, really) using the ["name"] notation for objects created using actionscript.
    In MXML the compiler is conveniently adding an attribute to the class with the same name as the id, so you can conveniently refer to it using the [] notation. While we explicitly specify an application container to use, the MXML compiler creates a custom container which is a derivative of the base container and to that it adds properties for the children declared in MXML. I guess it also effectively calls "addElement" for us when  the container is being constructed.
    Your example assumes that using "addElement" to add the button to the application container is the same as declaring a variable (ie property ). It isn't, so there's no point in looking for an property of the name "as3Button" using the [] notation, because it doesn't exist. The container is managing a collection of children in it's display list and that's not the same as being accessible as properties of the container.
    Generally speaking, accessing properties using the ["name"] syntax isn't necessary.
    Paul
    [edit: you may wonder why "addElement" doesn't conveniently also add the "id" attribute to be an property of the container class. Unfortunately, it can't because the container class would need to be dynamic and it's not. A further complication would be that adding properties at runtime would invite naming clashes at runtime with associated mayhem. MXML can do this because the compiler generates the class and can trap name duplication at compile time.
    Great question, BTW.
    -last edit changed my "attributes" to be "properties" in line with Adobe's terminology]

  • Is there a way of changing the alpha value of a symbol in its own timeline without ActionScript

    I'm trying to make an animated banner ad where radio waves emanate from a device as they fade in and fade out.
    I got it working, then realized I'd like the radio wave animation to loop repeatedly while the text in the ad comes in and out, so I thought maybe it should be a symbol and have the animation take place in its own timeline.
    Problem is, when I make the symbol and double click to enter its timeline, the color effect menu disappears.
    I don't feel comfortable in ActionScript yet. Is there no other way to do what I want?
    Can I create the radio waves as a separate animation file, then import it into the main animation?

    You should be able to make seperate keyframes and then modify the alpha of any MovieClip or Graphic objects within that keyframe. After that right click somewhere between the keyframes on the timeline and select "Create Classic Tween".
    NOTE: You have to have the keyframe selected on the timeline to be able to modify properties. So if you have a keyframe on frame 1, frame 10 and frame 20 set the alpha on frame 1 at 100%, frame 10 at 0% and frame 20 at 100% and it will fill in the blanks.
    EDIT:
    If the objects in your inner symbol are not a MovieClip or Graphic select all and then Right Click and select "Convert to Symbol" to make them one.

  • Passing null/empty values from a actionscript VO to a Coldfusion ORM object

    This is the situation.
    If you have an actionscript VO that binds to a Coldfusion ORM object via the RemoteClass metadata and some of the values are not set, null, or empty strings and you pass it from Flex to Coldfusion then the Coldfusion deserialization barfs saying the values are not acceptable date values (for type="date") or valid emails (for validation="email") or other such validations, even if required="false" on the property.
    For instance, if you have the following actionscript VO:
    package vo
        [RemoteClass(alias="com.companyname.Person")]
        [Bindable]
        public class Person
            public var person_id:Number;
            public var last_name:String;
            public var first_name:String;
            public var email:String;
            public var created_date:date;
         public function Person() {}
    And you have the corresponding Coldfusion component:
    <cfcomponent displayname="person" output="false"
        alias="com.companyname.Person"
        schema="dbo" persistent="true"
        table="PERSON">
        <cfproperty name="person_id" type="numeric" fieldtype="id" validate="integer" required="true" column="PERSON_ID"/>
        <cfproperty name="last_name" type="string" column="LAST_NAME" required="true"/>
        <cfproperty name="first_name" type="string" required="true" column="FIRST_NAME"/>
        <cfproperty name="email" type="string" validate="email" required="false" column="EMAIL"/>
        <cfproperty name="date_created" type="date" required="false" column="DATE_CREATED"/>
    </cfcomponent>
    Then if you pass the actionscript VO as is to Coldfusion, the deserialization complains that you do not have a valid email or a valid date for date_created.  This is bad, bad, bad.  Essentially if you have a validation of certain types (email being one) or a date property, or probably some other cases, then you essentially can not make it not required, it automatically makes it required because the Coldfusion serializer considers null/empty values as invalid dates or emails.  But the serializer should not care for values that are not required, there has to be a way to pass null/empty values to these data types, but apparently there's not.  If you pass an empty string ("") you still have the same problem.  I know Coldfusion does not have null values, but there has to be a way to do this, otherwise it defeats the purpose of having required="false" and some kind of validation on the property.
    There seems to be two ways around it.  One is to override the implicit setters for the properties on the Coldfusion side and check for 0 length values yourself, then set the property if it is not, or create your own validation routine.  I ended up creating my own validation function since I didn't want to have to write a setter function for everyone of these cases and I can pass back user friendly validation messages.
    Have other people encountered this problem?  How have you gotten around it?  Thanks.

    I realize that I didn't clarify that I am using ColdFusion
    for getting the data. This class was generated by the Create CFC
    wizard in Flex Builder.
    package com.generated
    [Managed]
    [RemoteClass(alias="components.generated.clients.Clients")]
    public class Clients
    public var clientid:Number = 0;
    public var clientfirstname:String = "";
    public var clientlastname:String = "";
    public var clientaddress1:String = "";
    public var clientaddress2:String = "";
    public var clientcity:String = "";
    public var clientstate:String = "";
    public var clientzip:String = "";
    public var clientphone:String = "";
    public var clientemail:String = "";
    public function Clients()
    }

  • How do I use Embed with an environment variable in an Actionscript AIR project Flash Builder 4.7

    I am using Flash Builder 4.7 to build an Actionscript AIR project.  The project embeds a number of png files from my local directory and I have been using absolute paths which all works fine.
    I have a laptop with which I want to start developing the same project - I set up a git repository that both the laptop and main pc can pull from and so I can get the source where I need it and push it back to the central repository.
    My problem is that the absolute paths for the embed commands don't work on the laptop as it has a different filesystem setup (Windows 8 with one drive as opposed to Windows 7 with a SSD and a data drive).  I thought the solution would be as easy as using an environment variable to specify the path which could then point to a different physical directory on both machines, i.e:
    [Embed(source = "DEVELOPER_RESOURCES/graphics/are/here.png"]
    I did a bit of research and there was quite a lot mentioned about setting up resource directories using path variables which I worked through but I just can't get it to compile.  The Actionscript compiler just won't find the png files however I specify the path.  I tried something with a FLEX project and the compiler didn't complain but I think this is because the compiler for FLEX uses a different convention.
    [Embed(source ="/Project Name/DEVELOPER_RESOURCES/graphics/are/here.png"]  works with FLEX but not Actionscript.
    So does anyone have a recipe for using the Embed command referencing assets using an environment variable that works across multiple machines with different file structures?

    I managed to find a solution on Windows which was to use symlinks and absolute paths.  You an basically point one directory to another so I did something like:
    mklink c:\developer_resources c:/the/local/path/to/my/resources
    and then reference all resources as c:\developer_resources\...
    Now as long as a developer machine has the right link (from c:\developer_resources to the place where the resources are kept) then it seems to work. 
    This doesn't however work for Mac and certainly isn't a solution for passing files between Mac and windows

  • Creating a Popup in ActionScript vs Creating a Popup in MXML

    Hello there
    I think I need a little help with a  couple of items. I'm using the Popup Library version 1.11 and I'm trying  to open up a Popup (with an associated presentation model) which I have  defined as follows.
    view.popup.EditSection.mxml
    view.popup.EditSectionPM.as
    the  view that opens the popup class (EditSection)  dows the following in  MXML, and it looks right, but it gives me limited access to the  reference of the popup window. With MXML it looks like this  http://grab.by/6Oaf
            <popup:PopUpFactory id="editSectionPopup" reuse="true" modal="true">
                 <fx:Component>
                     <popupWindows:EditSection/>
                 </fx:Component>
                 <popup:behaviors>
                     <spark:ZoomAndFadeBehavior duration="1000"/>
                     <behavior:KeepCenteredBehavior/>
                     <behavior:CenterBehavior/>
                     <popup:AddPopUpToParsleyContext />
                 </popup:behaviors>
             </popup:PopUpFactory>
    instead of  this, I've cobbled together the following ActionScript, but the popups  look VASTLY different when they open. Here is the ActionScript.. the  creationComplete runs the initializePopup() and the button click runs  the openPopup().. this version looks like http://grab.by/6Oaz when  opened.
    It doesnt seem to honor the height, width, etc  of the Class defining the popup, and when I click the different states,  I get errors indicating that no such states exist... though they exist  in the class
    question: Why might Cairngorm be opening up the wrong (generic?) TitleWindow? What am i doing wrong here?
        <fx:Script>
             <![CDATA[
                 import com.adobe.cairngorm.popup.PopUpFactory;
                 import com.adobe.cairngorm.popup.PopUpWrapper;
                 import com.adobe.cairngorm.popup.behavior.CenterBehavior;
                 import com.adobe.cairngorm.popup.behavior.KeepCenteredBehavior;
                 import com.adobe.cairngorm.popup.behavior.spark.ZoomAndFadeBehavior;
                 import com.company.psa.docbuilder.adhoc.view.editsection.EditSection;
                 import mx.collections.ArrayCollection;
                 import mx.controls.Alert;
                 private var wrapper:PopUpWrapper;
                 private var factory:PopUpFactory;
                 private var zoomAndFadeBehavior = new ZoomAndFadeBehavior();
                 public function initializePopup():void
                     var myEditSectionPopup:EditSection;
                     var myBehaviors:Array = new Array();
                     var myZAF = new ZoomAndFadeBehavior();
                     myBehaviors[0] = myZAF; // How do I set the duration?
                     myBehaviors[1] = new CenterBehavior()
                     myBehaviors[2] = new KeepCenteredBehavior();
                     factory = new PopUpFactory();
                     factory.popup = new ClassFactory(EditSection);
                     factory.reuse = false;
                     factory.modal = true;
                     factory.behaviors=myBehaviors;
                     // How do I reference the opened window?
                 public function openPopup () :void
                     factory.open = true;
             ]]>
         </fx:Script>
    Here is the definition of the EditSection.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009"
                    xmlns:s="library://ns.adobe.com/flex/spark"
                    xmlns:spicefactory="http://www.spicefactory.org/parsley"
                    xmlns:mx="library://ns.adobe.com/flex/mx"
                    enabled="true"
                    width.EditSectionState="500"
                    height.EditSectionState="350"
                    width.YesNoCancelState="320"
                    height.YesNoCancelState="200"
                    width.YesNoState="320"
                    height.YesNoState="200"
                    title="{pm.windowTitle}"
                    currentState="{pm.viewState}"
                    creationComplete="init()">
        <fx:Metadata>
             [Event(name="close", type="mx.events.CloseEvent")]
         </fx:Metadata>
        <fx:Script>
             <![CDATA[
                 import mx.binding.utils.BindingUtils;
                 import mx.controls.Alert;
                 import mx.core.mx_internal;
                 import mx.events.CloseEvent;
                [Inject]
                 [Bindable]
                 public var pm:EditSectionPM;
                protected function closeHandler(event:CloseEvent):void
                     pm.closeHandler(event);
                     trace("EditSection is closing");
                public function init():void
             ]]>
         </fx:Script>
         <s:states>
             <s:State name="EditSectionState"/>
             <s:State name="YesNoCancelState"/>
             <s:State name="YesNoState"/>
         </s:states>
        <fx:Declarations>
             <spicefactory:Configure/>
         </fx:Declarations>
        <!-- Define the transition to animate the change of view state. -->
         <s:transitions>
             <s:Transition fromState="EditSectionState">
                 <s:Parallel>
                     <mx:Resize target="{this}"
                                duration="500"/>
                 </s:Parallel>
             </s:Transition>
             <s:Transition fromState="YesNoCancelState">
                 <s:Sequence>
                     <mx:Resize target="{this}"
                                duration="500"/>
                 </s:Sequence>
             </s:Transition>
             <s:Transition fromState="YesNoState">
                 <s:Sequence>
                     <mx:Resize target="{this}"
                                duration="500"/>
                 </s:Sequence>
             </s:Transition>
         </s:transitions>
        <s:Label text="Hello There World"
                  left="10"
                  right="10"
                  top="10"
                  verticalAlign="middle"
                  textAlign="center"
                  click="pm.labelClickHandler(event)"/>
        <mx:ControlBar width="50%"
                        left="10"
                        bottom="10"
                        height="40"
                        horizontalAlign="left"
                        verticalAlign="middle">
             <mx:Button label="Cancel"
                        width="120"
                        click="dispatchEvent( new CloseEvent( CloseEvent.CLOSE ) )"
                        includeIn="EditSectionState"/>
             <mx:Button label="Reset to Default"
                        width="140"
                        click="dispatchEvent( new CloseEvent( CloseEvent.CLOSE ) )"
                        includeIn="EditSectionState"/>
         </mx:ControlBar>
         <mx:ControlBar width="50%"
                        right="10"
                        bottom="10"
                        height="40"
                        horizontalAlign="right"
                        verticalAlign="middle">
             <mx:Button label="Save"
                        width="140"
                        click="dispatchEvent( new CloseEvent( CloseEvent.CLOSE ) )"
                        includeIn="EditSectionState"/>
             <mx:Button id="yesButton"
                        label="Yes"
                        width="60"
                        click="dispatchEvent( new CloseEvent( CloseEvent.CLOSE ) )"
                        includeIn="YesNoCancelState,YesNoState"/>
             <mx:Button id="noButton"
                        label="No"
                        width="60"
                        click="dispatchEvent( new CloseEvent( CloseEvent.CLOSE ) )"
                        includeIn="YesNoCancelState,YesNoState"/>
             <mx:Button id="cancelButton"
                        label="Cancel"
                        width="60"
                        click="dispatchEvent( new CloseEvent( CloseEvent.CLOSE ) )"
                        includeIn="YesNoCancelState"/>
         </mx:ControlBar>
         <s:RadioButton id="editSectionsCheckbox"
                        y="30"
                        label="Edit Sections"
                        selected="true"
                        click="pm.editSectionStateClickHandler(event)"
                        y.YesNoCancelState="24"
                        y.YesNoState="24"
                        width.YesNoState="99"
                        horizontalCenter.EditSectionState="-2"
                        y.EditSectionState="30"
                        width.EditSectionState="95"
                        horizontalCenter.YesNoCancelState="-7"
                        horizontalCenter.YesNoState="-3"/>
         <s:RadioButton id="yesNoCancelCheckbox"
                        y="56"
                        label="Yes/No/Cancel"
                        click="pm.yesNoCancelStateClickHandler(event)"
                        y.YesNoCancelState="50"
                        y.YesNoState="50"
                        horizontalCenter.EditSectionState="-1"
                        y.EditSectionState="56"
                        horizontalCenter.YesNoCancelState="-3"
                        horizontalCenter.YesNoState="-3"/>
         <s:RadioButton id="yesNoCheckbox"
                        y="76"
                        label="Yes/No"
                        click="pm.yesNoStateClickHandler(event)"
                        width="99"
                        y.EditSectionState="83"
                        horizontalCenter.EditSectionState="-1"
                        horizontalCenter.YesNoCancelState="-3"
                        horizontalCenter.YesNoState="-3"/>
    </s:TitleWindow>
    Here is the definition of EditSectionPM.as
    /*   Copyright 2010                                                           */
    /*   All rights reserved.                                                     */
    package com.company.psa.docbuilder.adhoc.view.editsection
         import com.company.psa.docbuilder.adhoc.business.IDocumentConfigurationReceiver;
         import com.company.psa.docbuilder.core.business.DocumentConfiguration;
         import flash.events.MouseEvent;
         import mx.controls.Alert;
         import mx.events.CloseEvent;
         public class EditSectionPM implements IDocumentConfigurationReceiver
            [Bindable]
             public var height:int=300;
            [Bindable]
             public var message:String="Spark Popup";
            [Bindable]
             public var viewState:String="EditSectionState";
            [Bindable]
             public var width:int=400;
             [Bindable]
             public var windowTitle:String="Edit: ";
             [Bindable]
             public var documentConfiguration:DocumentConfiguration;
             public var isDirty:Boolean=false;
             public var cancelVisible:Boolean=false;
             // Implementing the notifier receiver design pattern
             public function setDocumentConfiguration(argDocumentConfiguration:DocumentConfiguration):void
                 this.documentConfiguration=argDocumentConfiguration;
             public function closeHandler(event:CloseEvent):void
                 trace("Close was clicked");
             public function cancelHandler(event:CloseEvent):void
                 trace("Cancel was clicked");
             public function resetHandler(event:CloseEvent):void
                 trace("Reset was clicked");
             public function yesHandler(event:CloseEvent):void
                 trace("Yes was clicked");
             public function noHandler(event:CloseEvent):void
                 trace("No was clicked");
             public function editSectionStateClickHandler(event:MouseEvent):void
                 trace("Edit Section state selected (setting this in the PM)");
                 this.viewState="EditSectionState";   
             public function yesNoCancelStateClickHandler(event:MouseEvent):void
                 trace("Yes/No/Cancel state selected (setting this in the PM)");
                 this.viewState="YesNoCancelState";
             public function yesNoStateClickHandler(event:MouseEvent):void
                 trace("Yes/No/Cancel state selected (setting this in the PM)");
                 this.viewState="YesNoState";   
             public function labelClickHandler(event:MouseEvent):void
                 trace("Label was clicked");
                 Alert.show("The Label"+event.toString() ,"You Clicked");

    Hi John,
    If you're using Flex 4, the PopUpFactory isn't needed anymore, you can use the PopUpWrapper for everything. More info here: https://sourceforge.net/adobe/cairngorm/wiki/HowToUseCairngormPopup/
    What's the reason you need a reference to the popup window? I ask because one very common reason is that users want to open and close it from elsewhere (i.e. a Presentation Model). For that, the popup library offers bindable property open, so all your behaviour object needs to do is to bind a Boolean to it and you don't need an extra view reference of the actual popup window. However, you could also get that if you listen to one of the open/close type events; inside each event object there's a popup property that points to the actual popup window. Regarding your AS usage, I didn't see anything wrong at first sight but maybe compare it the AS sample in the PopupTest project? But first, check if you really need to do it in AS as the MXML examples in PopupTest and on the how-to wiki read simpler IMHO.But also, let us know if it does'nt satisfy your use case.
    Alex

  • Flex 3 vs Flex 4 Preprocessor directives and code behind (External Actionscript file)

    I have a framework that I've built that I want to use on Flex3 and Flex4.
    I've added pre-processor directives as per this link (http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_21.html) and got my Flex 4 code to compile nicely.
    I then went to flex 3 and discovered my sub-class of Application wouldn't compile because it was based off of spark. No problem, I'll add in a directive.
    Except now my overridden class has duplicate code, specific to which SDK it is using.
    No problem, I'll put all of the application class code in an Actionscript file and include it in both Application class declarations for each directive.
    It works nicely in Flex 3, so I went to Flex 4, tried to compile and now I'm getting compiler errors saying things such as "The (private|public|protected) attribute may only be used on class property definitions." and "The (private|public|protected) attribute can only be used inside a package.
    This same file works in Flex 3, but not in Flex 4.
    What can I do to make the code compile in both places?
    I'll work on a simple case so I can upload some code.

    Nevermind.
    I got around this issue by renaming my sub-classed Application to "...Application".
    Now I can use a directive to specify an import statement for the extends Application portion rather than specifiing the fully qualified spark.components.Application or mx.core.Application.
    Lame - but done.

  • Problem with FLVPlayer in Flash CS3 (need to save out as Actionscript 3.0 SWf file)

    I am using Flash CS3 and am trying to publish a SWf file that
    makes use of the "FLVPlayback" component. I need for this SWF file
    to be published as an Actionscript 3.0 file, so I have set my
    publish settings to Flash Player 9.0 and Actionscript 3.0, but keep
    getting an error as follows:
    "WARNING: The component 'FLVPlayback' requires ActionScript
    2.0."
    Has anyone encountered this?? I am doing something wrong? I'm
    pretty comfortable within Actionscript/Flash 2.0, but am only
    beginning my first steps into the relam of CS3 and AS3.
    I have also attached a screenshot of the files that represent
    my FLVPlayback component (or so I assume). (see this link for
    attachments
    http://www.actionscript.org/forums/showthread.php3?t=140886)
    Thanks all,
    Mark
    http://www.actionscript.org/forums/showthread.php3?t=140886

    Mark,
    > I have set my publish settings to Flash Player 9.0 and
    Actionscript
    > 3.0, but keep getting an error as follows:
    >
    > "WARNING: The component 'FLVPlayback' requires
    ActionScript 2.0."
    Gotcha. You must have started the document in AS2, then
    changed the
    publish settings. Each version of the language has its own
    version of the
    FLVPlayback Component (written in the relevant language).
    Start over and
    compare two compleley new FLA documents: make one for AS3 and
    one for AS2.
    Open the Components panel and note the differences between
    the two. There
    are a different set of Components depending on the language
    chosen for the
    document. Drag the FLVPlayback Component from the Components
    panel in an
    AS3 document, and you'll have the AS3 version.
    David Stiller
    Co-author, Foundation Flash CS3 for Designers
    http://tinyurl.com/2k29mj
    "Luck is the residue of good design."

  • Video transmission with multithreading. I am having a problem?

    I am doing an application for sending video streams to multiple clients at the same time. So am using multithreading. I have the following codes to do the transmission. When I am using it with one thread only it is working fine. But when I use it with more threads for multiple transmissions I am have an error saying �Unable to realize com.sun.media.ProcessEngine�. Can anyone help me plz.
    import java.awt.*;
    import javax.media.*;
    import javax.media.protocol.*;
    import javax.media.protocol.DataSource;
    import javax.media.format.*;
    import javax.media.control.TrackControl;
    import javax.media.control.QualityControl;
    import java.io.*;
    import java.lang.Thread;
    public class VideoTransmitThread extends Thread{
    // Input MediaLocator
    // Can be a file or http or capture source
    private MediaLocator locator;
    private String ipAddress;
    private String port;
    private Processor processor = null;
    private DataSink rtptransmitter = null;
    private DataSource dataOutput = null;
    public VideoTransmitThread(MediaLocator locator,
                   String ipAddress,
                   String port) {
         this.locator = locator;
         this.ipAddress = ipAddress;
         this.port = port;
    * Starts the transmission. Returns null if transmission started ok.
    * Otherwise it returns a string with the reason why the setup failed.
    //run method for the thread
    public void run( ) {
         String result;
         // Create a processor for the specified media locator
         // and program it to output JPEG/RTP
         result =createProcessor();
         if (result != null)
         System.out.println("error: "+result);
         // Create an RTP session to transmit the output of the
         // processor to the specified IP address and port no.
         result =createTransmitter();
         if (result != null) {
         processor.close();
         processor = null;
         //return result;
         System.out.println("error: "+result);
         System.exit(0);
         try {
         Thread.sleep(1000); // 100 msec
         } catch (InterruptedException e) {
         return;
         // Start the transmission
         processor.start();
    * Stops the transmission if already started
    public void stop1() {
         synchronized (this) {
         if (processor != null) {
              processor.stop();
              processor.close();
              processor = null;
              rtptransmitter.close();
              rtptransmitter = null;
    private String createProcessor() {
         if (locator == null)
         return "Locator is null";
         DataSource ds;
         DataSource clone;
         try {
         ds = Manager.createDataSource(locator);
         } catch (Exception e) {
         return "Couldn't create DataSource";
         // Try to create a processor to handle the input media locator
         try {
         processor = Manager.createProcessor(ds);
         } catch (NoProcessorException npe) {
         return "Couldn't create processor";
         } catch (IOException ioe) {
         return "IOException creating processor";
         // Wait for it to configure
         boolean result = waitForState(processor, Processor.Configured);
         if (result == false)
         return "Couldn't configure processor";
         // Get the tracks from the processor
         TrackControl [] tracks = processor.getTrackControls();
         // Do we have atleast one track?
         if (tracks == null || tracks.length < 1)
         return "Couldn't find tracks in processor";
         boolean programmed = false;
         // Search through the tracks for a video track
         for (int i = 0; i < tracks.length; i++) {
         Format format = tracks.getFormat();
         if ( tracks[i].isEnabled() &&
              format instanceof VideoFormat &&
              !programmed) {
              // Found a video track. Try to program it to output JPEG/RTP
              // Make sure the sizes are multiple of 8's.
              Dimension size = ((VideoFormat)format).getSize();
              float frameRate = ((VideoFormat)format).getFrameRate();
              int w = (size.width % 8 == 0 ? size.width :
                        (int)(size.width / 8) * 8);
              int h = (size.height % 8 == 0 ? size.height :
                        (int)(size.height / 8) * 8);
              VideoFormat jpegFormat = new VideoFormat(VideoFormat.JPEG_RTP,
                                       new Dimension(w, h),
                                       Format.NOT_SPECIFIED,
                                       Format.byteArray,
                                       frameRate);
              tracks[i].setFormat(jpegFormat);
              System.err.println("Video transmitted as:");
              System.err.println(" " + jpegFormat);
              // Assume succesful
              programmed = true;
         } else
              tracks[i].setEnabled(false);
         if (!programmed)
         return "Couldn't find video track";
         // Set the output content descriptor to RAW_RTP
         ContentDescriptor cd = new ContentDescriptor(ContentDescriptor.RAW_RTP);
         processor.setContentDescriptor(cd);
         // Realize the processor. This will internally create a flow
         // graph and attempt to create an output datasource for JPEG/RTP
         // video frames.
         result = waitForState(processor, Controller.Realized);
         if (result == false)
         return "Couldn't realize processor";
         // Set the JPEG quality to .5.
         setJPEGQuality(processor, 0.5f);
         // Get the output data source of the processor
         dataOutput = processor.getDataOutput();
         return null;
    // Creates an RTP transmit data sink. This is the easiest way to create
    // an RTP transmitter. The other way is to use the RTPSessionManager API.
    // Using an RTP session manager gives you more control if you wish to
    // fine tune your transmission and set other parameters.
    private String createTransmitter() {
         // Create a media locator for the RTP data sink.
         // For example:
         // rtp://129.130.131.132:42050/video
         String rtpURL = "rtp://" + ipAddress + ":" + port + "/video";
         MediaLocator outputLocator = new MediaLocator(rtpURL);
         // Create a data sink, open it and start transmission. It will wait
         // for the processor to start sending data. So we need to start the
         // output data source of the processor. We also need to start the
         // processor itself, which is done after this method returns.
         try {
         rtptransmitter = Manager.createDataSink(dataOutput, outputLocator);
         rtptransmitter.open();
         rtptransmitter.start();
         dataOutput.start();
         } catch (MediaException me) {
         return "Couldn't create RTP data sink";
         } catch (IOException ioe) {
         return "Couldn't create RTP data sink";
         return null;
    * Setting the encoding quality to the specified value on the JPEG encoder.
    * 0.5 is a good default.
    void setJPEGQuality(Player p, float val) {
         Control cs[] = p.getControls();
         QualityControl qc = null;
         VideoFormat jpegFmt = new VideoFormat(VideoFormat.JPEG);
         // Loop through the controls to find the Quality control for
         // the JPEG encoder.
         for (int i = 0; i < cs.length; i++) {
         if (cs[i] instanceof QualityControl &&
              cs[i] instanceof Owned) {
              Object owner = ((Owned)cs[i]).getOwner();
              // Check to see if the owner is a Codec.
              // Then check for the output format.
              if (owner instanceof Codec) {
              Format fmts[] = ((Codec)owner).getSupportedOutputFormats(null);
              for (int j = 0; j < fmts.length; j++) {
                   if (fmts[j].matches(jpegFmt)) {
                   qc = (QualityControl)cs[i];
                   qc.setQuality(val);
                   System.err.println("- Setting quality to " +
                             val + " on " + qc);
                   break;
              if (qc != null)
              break;
    * Convenience methods to handle processor's state changes.
    private Integer stateLock = new Integer(0);
    private boolean failed = false;
    Integer getStateLock() {
         return stateLock;
    void setFailed() {
         failed = true;
    private synchronized boolean waitForState(Processor p, int state) {
         p.addControllerListener(new StateListener());
         failed = false;
         // Call the required method on the processor
         if (state == Processor.Configured) {
         p.configure();
         } else if (state == Processor.Realized) {
         p.realize();
         // Wait until we get an event that confirms the
         // success of the method, or a failure event.
         // See StateListener inner class
         while (p.getState() < state && !failed) {
         synchronized (getStateLock()) {
              try {
              getStateLock().wait();
              } catch (InterruptedException ie) {
              return false;
         if (failed)
         return false;
         else
         return true;
    * Inner Classes
    class StateListener implements ControllerListener {
         public void controllerUpdate(ControllerEvent ce) {
         // If there was an error during configure or
         // realize, the processor will be closed
         if (ce instanceof ControllerClosedEvent)
              setFailed();
         // All controller events, send a notification
         // to the waiting thread in waitForState method.
         if (ce instanceof ControllerEvent) {
              synchronized (getStateLock()) {
              getStateLock().notifyAll();
    * Sample Usage for VideoTransmitNew class
    public static void main(String [] args) {
         // We need three parameters to do the transmission
         // For example,
         // java VideoTransmitNew file:/C:/media/test.mov 129.130.131.132 42050
         System.err.println("Start transmission");
         //Create a video transmit object with the specified params.
    MediaLocator URL=new MediaLocator("file:///C:/media/test.mpg");
    //Am using 3 different threads.
         new VideoTransmitThread(URL,"CSELAB12PC10","9876").start();
         new VideoTransmitThread(URL," CSELAB12PC11","9870").start();
         new VideoTransmitThread(URL," CSELAB12PC12","9690").start();
         //close all transmission before quiting.

    Hm, that was my silver bullet. Other than doing an uninsall and then installing Presenter again, you may need to reach out to Adobe and see if they can identify what could be causing this.

  • "Rough" GIF export from ActionScript 3 files impossible?

    Hello,
    I just upgraded from Flash CS3 to Flash CS5, and I've been playing with the various new features. However, I've just encountered an odd problem that I can't seem to find a solution to.
    In the past, I've made animated GIFs in CS3 by exporting them with the "Smooth" box unchecked. This was really convenient for me because not only could I export crisp pixel bitmaps from Flash, but I could edit it in another program later. I was planning on making some GIF animations via this process with the aid of the bone tool in CS4 and 5.
    When I tried exporting frames of of a figure created with the bone tool in CS5, however, I got images that were fuzzy and often had distorted colors. After some time, I realized that this was because in CS3, I had exported the images from ActionScript 2 files, while the bone tool only works in ActionScript 3 files.
    Is it not possible to export "rough" GIFs from ActionScript 3 files, or is there a trick to doing that that I'm somehow missing?

    I'm sorry for not making it clear in my initial post, but it doesn't matter whether I create an image using the bone tool or not -- any GIF image exported from an AS3 file always has an antialiased appearance, even when the Smooth box is unchecked.
    To show you what I mean, here's a simple GIF image I exported from an AS2 file:
    Notice that all of the lines are simple and pixellated, with no antialiasing at all. This is the kind of GIF I want to export from an AS3 file.
    Now here's the exact same image I exported from an AS3 file, with the exact same export settings:
    As you can see, all of the lines look smoothed, even though I made sure the Smooth box was unchecked.
    Is there anything I can do to correct this problem?

  • Animated .gif actionscript 3 question

    I hqve some small swfs that I need to convert to animated .gifs for
    a client. I assumed this this was a painless task but I was oh so wrong as the bigger the swf the worse
    the animated gif looks. But I have some small.swfs I need to convert and I did and they do not look bad but my problem is the swf had clikTag info in it for googleadwords. When I converted to animated .gif the file does not have any actions inside, which leads me to ask how do I pass actionscript to an animated .gif done in Flash?
    anybody??
    rdee

    HTML links are likely your only recourse.  If you need help with that, visit the Dreamweaver or web design forums.  They might have some alternative approaches to offer as well, possibly using javascript or something along those lines.

  • Newbie questions on fms and actionscript 3

    Ok, like I said I'm a newbie, but I do understand the differance between ssas and as3. Not all, but all most everything I see written in SSAS can be writen into a external AS3 file. This leads me to quite a few questions I'm hoping you kind people can shed some light on for me.
    1)  What is the advantage of writing a SSAS file over an external AS3 file?
    2) Can I write an .asc file in AS3 or do I have to use AS1? Please understand I'm using tuts from fmsguru.com and the books "Learning Flash Media Server" (pdf) and "Programming Flash Communication Server". I'm not a javascript programmer so nothing I do in AS1 seems to make any sence while everything I do in AS3 does. It may not seem like it to you people that are programmers, but to those of us that aren't, AS1 and AS3 are miles apart.
    3) kind of off topic, but a security question. I'm not a "hacker" and don't like the jerks that are. My question is on external AS / SSAS files and swf files. When my fla is compiled into a swf does my external AS files remain external? I assume they do, but then what is the threat of the swf being decompiled? In most projects I would do I could care less if somebody had access to my fla as long as they don't have my actionscript files.
    I don't know. Maybe on questions one and two I'm getting confused becasue I'm using out dated material. Again I assume that even though fms was built off of the javascript engine it should be able to read and execute my AS3 file. Other wise what was the point of the evolution of actionscript into a fully functional programming language?
    Thanks for any help you might have...

    1) I did not get this question correcly - for that matter SSAS can only be in AS1 - so i dont see reason comparing them
    2) It has to be AS1
    3) if you doing "include" stuff - i think code would go into compiled swf and proper decompiler would give you the code.
    Last para - Server-side engine understands only AS1 so it wont be able to read and understand your AS3 file.

  • Using Actionscript to generate a grid

    Hello all.
    I am working on a Flash project and have a problem that has
    turned out to be a real head scratcher for me. I need to create a
    Flash form that will generate a floorplan grid based upon width and
    length values entered by the user. I have successfully completed
    part of the task and I am able to generate a grid based upon the
    width and length entered by the user.
    Here is my problem: When the Width and Length "units" are
    entered as feet, I need to generate a grid that displays 1 grid
    square for every 5 feet of length or width entered, (the scale is 1
    square grid = 5 ft so if you entered a 50 ft building length or
    width the "length or width" side of the grid would be 10 grid units
    in length). Then, if the user re-enters new values for the width
    and height and clicks "draw floorplan"
    again
    the grid needs to regenerate
    again
    at the proper size. Currently my sample generates 1 grid for
    every foot of length or width entered and will not regenerate
    properly.
    Below is a link to a sample of where I am so far as well as
    the Actionscript I am using to control the sample file.
    Can anyone provide some pointers on how to generate the grid
    with one grid representing 5ft and how to regenerate the grid once
    new values are input and the "draw floorplan" button is clicked
    again? (Also, ultimately I need to then send the form data as
    email.)
    Any help is very much appreciated!
    Bitjammer
    Link to sample:
    http://216.197.127.249/grid/grid_sample_1.html
    (Try entering 10 width and 10 length then click draw floor
    plan)
    Here is my actionscript code so far:
    my_button.addEventListener("onPress",gridf);
    my_button.onPress=function(){if(Number(widthTF.text)>1&&Number(heightTF.text)>1){gridF(Num ber(widthTF.text),Number(heightTF.text))
    function gridF(h,w){
    initX = 0;
    initY = 0;
    counter = 0;
    for (var i = 1; i<=h; i++) {
    for (var j = 1; j<=w; j++) {
    counter++;
    grid_container.attachMovie("cellMC", "cell"+counter,
    counter);
    grid_container["cell"+counter]._x = initX;
    grid_container["cell"+counter]._y = initY;
    initX += 15;
    initY += 15;
    initX = 0;
    (For clarification: the width input variable is widthTF and
    height input varible is heightTF.)

    Thanks for taking time to answer my post, kglad.
    Yes. I believe I understand. I could create another button
    and call it "Reset Grid" and call this function, however what I am
    hoping for is to have the grid redraw simply by the user entering
    new values for the width and height and then clicking "draw
    floorplan" again.
    Currently the first line of code is:
    my_button.addEventListener("onPress",gridf); Should not the grid
    redraw each time and then parse the new values in the width and
    height fields? I am sure I am just dense but my grid is not
    clearing each time the "draw " button is clicked.
    You can see this happen on the sample link below. After
    entering say 20 width and 20 height values and clicking "draw"
    button, the grid is created perfectly. Then if, say new values of
    10 width and 10 height are entered and "draw" button is clicked,
    the grid does not redraw correctly using these new values.
    Sample link:
    http://216.197.127.249/grid/grid_sample_1.html
    Could the problem be that the gridf function should happen as
    the first function in the script before the new values are parsed
    again? Should a: grid_container.removeMovieClip(); execute before
    anything else is executed each time the "draw" button is clicked?

  • Pro*c multithreaded application has memory leak

    Hi there,
    I posted this message a week ago in OCI section, nobody answer me.
    I am really curious if my application has a bug or the pro*c has a bug.
    Anyone can compile the sample code and test it easily.
    I made multithreaded application which queries dynamic SQL, it works.
    But the memory leaks when i query the SQL statement.
    The more memory leaks, the more i query the SQL statement, even same SQL
    statement.
    I check it with top, shell command.
    My machine is SUN E450, Solaris 8. Oracle 9.2.0.1
    Compiler : gcc (GCC) 3.2.2
    I changed source code which is from
    $(ORACLE_HOME)/precomp/demo/proc/sample10.pc
    the sample10 doesn't need to be multithreaded. But i think it has to work
    correctly if i changed it to multithreaded application.
    the make file and source code will be placed below.
    I have to figure out the problem.
    Please help
    Thanks in advance,
    the make file is below
    HOME = /user/jkku
    ORA = $(ORACLE_HOME)
    CC = gcc
    PROC = proc
    LC_INCL = -I$(HOME)/work/dbmss/libs/include
    lc_incl = include=$(HOME)/work/dbmss/libs/include
    SYS_INCL =
    sys_incl =
    ORA_INCL = -I. \
    -I$(ORA)/precomp/public \
    -I$(ORA)/rdbms/public \
    -I$(ORA)/rdbms/demo \
    -I$(ORA)/rdbms/pbsql/public \
    -I$(ORA)/network/public \
    -DSLMXMX_ENABLE -DSLTS_ENABLE -D_SVID_GETTOD
    INCLUDES = $(LC_INCL) $(SYS_INCL) $(ORA_INCL)
    includes = $(lc_incl) $(sys_incl)
    LC_LIBS =
    SYS_LIBS = -lpthread -lsocket -lnsl -lrt
    ORA_LIBS = -L$(ORA)/lib/ -lclntsh
    LIBS = $(LC_LIBS) $(SYS_LIBS) $(ORA_LIBS)
    # Define C Compiler flags
    CFLAGS += -D_Solaris64_ -m64
    CFLAGS += -g -D_REENTRANT
    # Define pro*c Compiler flags
    PROCFLAGS += THREADS=YES
    PROCFLAGS += CPOOL=YES
    # Our object files
    PRECOMPS = sample10.c
    OBJS = sample10.o
    .SUFFIXES: .o .c .pc
    .c.o:
    $(CC) -c $(CFLAGS) $(INCLUDES) $*.c
    .pc.c:
    $(PROC) $(PROCFLAGS) $(includes) $*.pc $*.c
    all: sample10
    sample10: $(PRECOMPS) $(OBJS)
    $(CC) $(CFLAGS) -o sample10 $(OBJS) $(LIBS)
    clean:
    rm -rf *.o sample10 sample10.c
    the source code is below which i changed the oracle sample10.pc to
    multithreaded application.
    Sample Program 10: Dynamic SQL Method 4
    This program connects you to ORACLE using your username and
    password, then prompts you for a SQL statement. You can enter
    any legal SQL statement. Use regular SQL syntax, not embedded SQL.
    Your statement will be processed. If it is a query, the rows
    fetched are displayed.
    You can enter multi-line statements. The limit is 1023 characters.
    This sample program only processes up to MAX_ITEMS bind variables and
    MAX_ITEMS select-list items. MAX_ITEMS is #defined to be 40.
    #include <stdio.h>
    #include <string.h>
    #include <setjmp.h>
    #include <sqlda.h>
    #include <stdlib.h>
    #include <sqlcpr.h>
    /* Maximum number of select-list items or bind variables. */
    #define MAX_ITEMS 40
    /* Maximum lengths of the names of the
    select-list items or indicator variables. */
    #define MAX_VNAME_LEN 30
    #define MAX_INAME_LEN 30
    #ifndef NULL
    #define NULL 0
    #endif
    /* Prototypes */
    #if defined(__STDC__)
    void sql_error(void);
    int oracle_connect(void);
    int alloc_descriptors(int, int, int);
    int get_dyn_statement(void);
    void set_bind_variables(void);
    void process_select_list(void);
    void help(void);
    #else
    void sql_error(/*_ void _*/);
    int oracle_connect(/*_ void _*/);
    int alloc_descriptors(/*_ int, int, int _*/);
    int get_dyn_statement(/* void _*/);
    void set_bind_variables(/*_ void -*/);
    void process_select_list(/*_ void _*/);
    void help(/*_ void _*/);
    #endif
    char *dml_commands[] = {"SELECT", "select", "INSERT", "insert",
    "UPDATE", "update", "DELETE", "delete"};
    EXEC SQL INCLUDE sqlda;
    EXEC SQL INCLUDE sqlca;
    EXEC SQL BEGIN DECLARE SECTION;
    char dyn_statement[1024];
    EXEC SQL VAR dyn_statement IS STRING(1024);
    EXEC SQL END DECLARE SECTION;
    EXEC ORACLE OPTION (ORACA=YES);
    EXEC ORACLE OPTION (RELEASE_CURSOR=YES);
    SQLDA *bind_dp;
    SQLDA *select_dp;
    /* Define a buffer to hold longjmp state info. */
    jmp_buf jmp_continue;
    char *db_uid="dbmuser/dbmuser@dbmdb";
    sql_context ctx;
    int err_sql;
    enum{
    SQL_SUCC=0,
    SQL_ERR,
    SQL_NOTFOUND,
    SQL_UNIQUE,
    SQL_DISCONNECT,
    SQL_NOTNULL
    int main()
    int i;
    EXEC SQL ENABLE THREADS;
    EXEC SQL WHENEVER SQLERROR DO sql_error();
    EXEC SQL WHENEVER NOT FOUND DO sql_not_found();
    /* Connect to the database. */
    if (connect_database() < 0)
    exit(1);
    EXEC SQL CONTEXT USE :ctx;
    /* Process SQL statements. */
    for (;;)
    /* Allocate memory for the select and bind descriptors. */
    if (alloc_descriptors(MAX_ITEMS, MAX_VNAME_LEN, NAME_LEN) != 0)
    exit(1);
    (void) setjmp(jmp_continue);
    /* Get the statement. Break on "exit". */
    if (get_dyn_statement() != 0)
    break;
    EXEC SQL PREPARE S FROM :dyn_statement;
    EXEC SQL DECLARE C CURSOR FOR S;
    /* Set the bind variables for any placeholders in the
    SQL statement. */
    set_bind_variables();
    /* Open the cursor and execute the statement.
    * If the statement is not a query (SELECT), the
    * statement processing is completed after the
    * OPEN.
    EXEC SQL OPEN C USING DESCRIPTOR bind_dp;
    /* Call the function that processes the select-list.
    * If the statement is not a query, this function
    * just returns, doing nothing.
    process_select_list();
    /* Tell user how many rows processed. */
    for (i = 0; i < 8; i++)
    if (strncmp(dyn_statement, dml_commands, 6) == 0)
    printf("\n\n%d row%c processed.\n", sqlca.sqlerrd[2], sqlca.sqlerrd[2] == 1 ? '\0' : 's');
    break;
    /* Close the cursor. */
    EXEC SQL CLOSE C;
    /* When done, free the memory allocated for pointers in the bind and
    select descriptors. */
    for (i = 0; i < MAX_ITEMS; i++)
    if (bind_dp->V != (char *) 0)
    free(bind_dp->V);
    free(bind_dp->I); /* MAX_ITEMS were allocated. */
    if (select_dp->V != (char *) 0)
    free(select_dp->V);
    free(select_dp->I); /* MAX_ITEMS were allocated. */
    /* Free space used by the descriptors themselves. */
    SQLSQLDAFree(ctx, bind_dp);
    SQLSQLDAFree(ctx, select_dp);
    } /* end of for(;;) statement-processing loop */
    disconnect_database();
    EXEC SQL WHENEVER SQLERROR CONTINUE;
    EXEC SQL COMMIT WORK RELEASE;
    puts("\nHave a good day!\n");
    return;
    * Allocate the BIND and SELECT descriptors using sqlald().
    * Also allocate the pointers to indicator variables
    * in each descriptor. The pointers to the actual bind
    * variables and the select-list items are realloc'ed in
    * the set_bind_variables() or process_select_list()
    * routines. This routine allocates 1 byte for select_dp->V
    * and bind_dp->V, so the realloc will work correctly.
    alloc_descriptors(size, max_vname_len, max_iname_len)
    int size;
    int max_vname_len;
    int max_iname_len;
    int i;
    * The first sqlald parameter determines the maximum number of
    * array elements in each variable in the descriptor. In
    * other words, it determines the maximum number of bind
    * variables or select-list items in the SQL statement.
    * The second parameter determines the maximum length of
    * strings used to hold the names of select-list items
    * or placeholders. The maximum length of column
    * names in ORACLE is 30, but you can allocate more or less
    * as needed.
    * The third parameter determines the maximum length of
    * strings used to hold the names of any indicator
    * variables. To follow ORACLE standards, the maximum
    * length of these should be 30. But, you can allocate
    * more or less as needed.
    if ((bind_dp =
    SQLSQLDAAlloc(ctx, size, max_vname_len, max_iname_len)) ==
    (SQLDA *) 0)
    fprintf(stderr,
    "Cannot allocate memory for bind descriptor.");
    return -1; /* Have to exit in this case. */
    if ((select_dp =
    SQLSQLDAAlloc(ctx, size, max_vname_len, max_iname_len)) == (SQLDA *)
    0)
    fprintf(stderr,
    "Cannot allocate memory for select descriptor.");
    return -1;
    select_dp->N = MAX_ITEMS;
    /* Allocate the pointers to the indicator variables, and the
    actual data. */
    for (i = 0; i < MAX_ITEMS; i++) {
    bind_dp->I = (short *) malloc(sizeof (short));
    select_dp->I = (short *) malloc(sizeof(short));
    bind_dp->V = (char *) malloc(1);
    select_dp->V = (char *) malloc(1);
    return 0;
    int get_dyn_statement()
    char *cp, linebuf[256];
    int iter, plsql;
    for (plsql = 0, iter = 1; ;)
    if (iter == 1)
    printf("\nSQL> ");
    dyn_statement[0] = '\0';
    fgets(linebuf, sizeof linebuf, stdin);
    cp = strrchr(linebuf, '\n');
    if (cp && cp != linebuf)
    *cp = ' ';
    else if (cp == linebuf)
    continue;
    if ((strncmp(linebuf, "EXIT", 4) == 0) ||
    (strncmp(linebuf, "exit", 4) == 0))
    return -1;
    else if (linebuf[0] == '?' ||
    (strncmp(linebuf, "HELP", 4) == 0) ||
    (strncmp(linebuf, "help", 4) == 0))
    help();
    iter = 1;
    continue;
    if (strstr(linebuf, "BEGIN") ||
    (strstr(linebuf, "begin")))
    plsql = 1;
    strcat(dyn_statement, linebuf);
    if ((plsql && (cp = strrchr(dyn_statement, '/'))) ||
    (!plsql && (cp = strrchr(dyn_statement, ';'))))
    *cp = '\0';
    break;
    else
    iter++;
    printf("%3d ", iter);
    return 0;
    void set_bind_variables()
    int i, n;
    char bind_var[64];
    /* Describe any bind variables (input host variables) */
    EXEC SQL WHENEVER SQLERROR DO sql_error();
    bind_dp->N = MAX_ITEMS; /* Initialize count of array elements. */
    EXEC SQL DESCRIBE BIND VARIABLES FOR S INTO bind_dp;
    /* If F is negative, there were more bind variables
    than originally allocated by sqlald(). */
    if (bind_dp->F < 0)
    printf ("\nToo many bind variables (%d), maximum is %d\n.",
    -bind_dp->F, MAX_ITEMS);
    return;
    /* Set the maximum number of array elements in the
    descriptor to the number found. */
    bind_dp->N = bind_dp->F;
    /* Get the value of each bind variable as a
    * character string.
    * C contains the length of the bind variable
    * name used in the SQL statement.
    * S contains the actual name of the bind variable
    * used in the SQL statement.
    * L will contain the length of the data value
    * entered.
    * V will contain the address of the data value
    * entered.
    * T is always set to 1 because in this sample program
    * data values for all bind variables are entered
    * as character strings.
    * ORACLE converts to the table value from CHAR.
    * I will point to the indicator value, which is
    * set to -1 when the bind variable value is "null".
    for (i = 0; i < bind_dp->F; i++)
    printf ("\nEnter value for bind variable %.*s: ",
    (int)bind_dp->C, bind_dp->S);
    fgets(bind_var, sizeof bind_var, stdin);
    /* Get length and remove the new line character. */
    n = strlen(bind_var) - 1;
    /* Set it in the descriptor. */
    bind_dp->L = n;
    /* (re-)allocate the buffer for the value.
    sqlald() reserves a pointer location for
    V but does not allocate the full space for
    the pointer. */
    bind_dp->V = (char *) realloc(bind_dp->V, (bind_dp->L + 1));
    /* And copy it in. */
    strncpy(bind_dp->V, bind_var, n);
    /* Set the indicator variable's value. */
    if ((strncmp(bind_dp->V, "NULL", 4) == 0) ||
    (strncmp(bind_dp->V, "null", 4) == 0))
    *bind_dp->I = -1;
    else
    *bind_dp->I = 0;
    /* Set the bind datatype to 1 for CHAR. */
    bind_dp->T = 1;
    return;
    void process_select_list()
    int i, null_ok, precision, scale;
    if ((strncmp(dyn_statement, "SELECT", 6) != 0) &&
    (strncmp(dyn_statement, "select", 6) != 0))
    select_dp->F = 0;
    return;
    /* If the SQL statement is a SELECT, describe the
    select-list items. The DESCRIBE function returns
    their names, datatypes, lengths (including precision
    and scale), and NULL/NOT NULL statuses. */
    select_dp->N = MAX_ITEMS;
    EXEC SQL DESCRIBE SELECT LIST FOR S INTO select_dp;
    /* If F is negative, there were more select-list
    items than originally allocated by sqlald(). */
    if (select_dp->F < 0)
    printf ("\nToo many select-list items (%d), maximum is %d\n",
    -(select_dp->F), MAX_ITEMS);
    return;
    /* Set the maximum number of array elements in the
    descriptor to the number found. */
    select_dp->N = select_dp->F;
    /* Allocate storage for each select-list item.
    sqlprc() is used to extract precision and scale
    from the length (select_dp->L).
    sqlnul() is used to reset the high-order bit of
    the datatype and to check whether the column
    is NOT NULL.
    CHAR datatypes have length, but zero precision and
    scale. The length is defined at CREATE time.
    NUMBER datatypes have precision and scale only if
    defined at CREATE time. If the column
    definition was just NUMBER, the precision
    and scale are zero, and you must allocate
    the required maximum length.
    DATE datatypes return a length of 7 if the default
    format is used. This should be increased to
    9 to store the actual date character string.
    If you use the TO_CHAR function, the maximum
    length could be 75, but will probably be less
    (you can see the effects of this in SQL*Plus).
    ROWID datatype always returns a fixed length of 18 if
    coerced to CHAR.
    LONG and
    LONG RAW datatypes return a length of 0 (zero),
    so you need to set a maximum. In this example,
    it is 240 characters.
    printf ("\n");
    for (i = 0; i < select_dp->F; i++)
    char title[MAX_VNAME_LEN];
    /* Turn off high-order bit of datatype (in this example,
    it does not matter if the column is NOT NULL). */
    sqlnul ((unsigned short *)&(select_dp->T), (unsigned short
    *)&(select_dp->T), &null_ok);
    switch (select_dp->T)
    case 1 : /* CHAR datatype: no change in length
    needed, except possibly for TO_CHAR
    conversions (not handled here). */
    break;
    case 2 : /* NUMBER datatype: use sqlprc() to
    extract precision and scale. */
    sqlprc ((unsigned int *)&(select_dp->L), &precision,
    &scale);
    /* Allow for maximum size of NUMBER. */
    if (precision == 0) precision = 40;
    /* Also allow for decimal point and
    possible sign. */
    /* convert NUMBER datatype to FLOAT if scale > 0,
    INT otherwise. */
    if (scale > 0)
    select_dp->L = sizeof(float);
    else
    select_dp->L = sizeof(int);
    break;
    case 8 : /* LONG datatype */
    select_dp->L = 240;
    break;
    case 11 : /* ROWID datatype */
    case 104 : /* Universal ROWID datatype */
    select_dp->L = 18;
    break;
    case 12 : /* DATE datatype */
    select_dp->L = 9;
    break;
    case 23 : /* RAW datatype */
    break;
    case 24 : /* LONG RAW datatype */
    select_dp->L = 240;
    break;
    /* Allocate space for the select-list data values.
    sqlald() reserves a pointer location for
    V but does not allocate the full space for
    the pointer. */
    if (select_dp->T != 2)
    select_dp->V = (char *) realloc(select_dp->V,
    select_dp->L + 1);
    else
    select_dp->V = (char *) realloc(select_dp->V,
    select_dp->L);
    /* Print column headings, right-justifying number
    column headings. */
    /* Copy to temporary buffer in case name is null-terminated */
    memset(title, ' ', MAX_VNAME_LEN);
    strncpy(title, select_dp->S, select_dp->C);
    if (select_dp->T == 2)
    if (scale > 0)
    printf ("%.*s ", select_dp->L+3, title);
    else
    printf ("%.*s ", select_dp->L, title);
    else
    printf("%-.*s ", select_dp->L, title);
    /* Coerce ALL datatypes except for LONG RAW and NUMBER to
    character. */
    if (select_dp->T != 24 && select_dp->T != 2)
    select_dp->T = 1;
    /* Coerce the datatypes of NUMBERs to float or int depending on
    the scale. */
    if (select_dp->T == 2)
    if (scale > 0)
    select_dp->T = 4; /* float */
    else
    select_dp->T = 3; /* int */
    printf ("\n\n");
    /* FETCH each row selected and print the column values. */
    EXEC SQL WHENEVER NOT FOUND GOTO end_select_loop;
    for (;;)
    EXEC SQL FETCH C USING DESCRIPTOR select_dp;
    /* Since each variable returned has been coerced to a
    character string, int, or float very little processing
    is required here. This routine just prints out the
    values on the terminal. */
    for (i = 0; i < select_dp->F; i++)
    if (*select_dp->I < 0)
    if (select_dp->T == 4)
    printf ("%-*c ",(int)select_dp->L+3, ' ');
    else
    printf ("%-*c ",(int)select_dp->L, ' ');
    else
    if (select_dp->T == 3) /* int datatype */
    printf ("%*d ", (int)select_dp->L,
    *(int *)select_dp->V);
    else if (select_dp->T == 4) /* float datatype */
    printf ("%*.2f ", (int)select_dp->L,
    *(float *)select_dp->V);
    else /* character string */
    printf ("%-*.*s ", (int)select_dp->L,
    (int)select_dp->L, select_dp->V);
    printf ("\n");
    end_select_loop:
    return;
    void help()
    puts("\n\nEnter a SQL statement or a PL/SQL block at the SQL> prompt.");
    puts("Statements can be continued over several lines, except");
    puts("within string literals.");
    puts("Terminate a SQL statement with a semicolon.");
    puts("Terminate a PL/SQL block (which can contain embedded
    semicolons)");
    puts("with a slash (/).");
    puts("Typing \"exit\" (no semicolon needed) exits the program.");
    puts("You typed \"?\" or \"help\" to get this message.\n\n");
    int connect_database()
    err_sql = SQL_SUCC;
    EXEC SQL WHENEVER SQLERROR DO sql_error();
    EXEC SQL WHENEVER NOT FOUND DO sql_not_found();
    EXEC SQL CONTEXT ALLOCATE :ctx;
    EXEC SQL CONTEXT USE :ctx;
    EXEC SQL CONNECT :db_uid;
    if(err_sql != SQL_SUCC){
    printf("err => connect database(ctx:%ld, uid:%s) failed!\n", ctx, db_uid);
    return -1;
    return 1;
    int disconnect_database()
    err_sql = SQL_SUCC;
    EXEC SQL WHENEVER SQLERROR DO sql_error();
    EXEC SQL WHENEVER NOT FOUND DO sql_not_found();
    EXEC SQL CONTEXT USE :ctx;
    EXEC SQL COMMIT WORK RELEASE;
    EXEC SQL CONTEXT FREE:ctx;
    return 1;
    void sql_error()
    printf("err => %.*s", sqlca.sqlerrm.sqlerrml, sqlca.sqlerrm.sqlerrmc);
    printf("in \"%.*s...\'\n", oraca.orastxt.orastxtl, oraca.orastxt.orastxtc);
    printf("on line %d of %.*s.\n\n", oraca.oraslnr, oraca.orasfnm.orasfnml,
    oraca.orasfnm.orasfnmc);
    switch(sqlca.sqlcode) {
    case -1: /* unique constraint violated */
    err_sql = SQL_UNIQUE;
    break;
    case -1012: /* not logged on */
    case -1089:
    case -3133:
    case -1041:
    case -3114:
    case -3113:
    /* �6�Ŭ�� shutdown�ǰų� �α��� ���°� �ƴҶ� ��b�� �õ� */
    /* immediate shutdown in progress - no operations are permitted */
    /* end-of-file on communication channel */
    /* internal error. hostdef extension doesn't exist */
    err_sql = SQL_DISCONNECT;
    break;
    case -1400:
    err_sql = SQL_NOTNULL;
    break;
    default:
    err_sql = SQL_ERR;
    break;
    EXEC SQL CONTEXT USE :ctx;
    EXEC SQL WHENEVER SQLERROR CONTINUE;
    EXEC SQL ROLLBACK WORK;
    void sql_not_found()
    err_sql = SQL_NOTFOUND;

    Hi Jane,
    What version of Berkeley DB XML are you using?
    What is your operating system and your hardware platform?
    For how long have been the application running?
    What is your current container size?
    What's set for EnvironmentConfig.setThreaded?
    Do you know if containers have previously not been closed correctly?
    Can you please post the entire error output?
    What's the JDK version, 1.4 or 1.5?
    Thanks,
    Bogdan

Maybe you are looking for

  • Changing host computer name

    When I first set-up my iPad3, the computer [windows] I used was named "eyore1.  I recently changed computers [Windows]; the new computer is named "eyore"  My ipad will not sync.  It seems to be waiting until it's connected to "eyore1".  How can I cha

  • BPM - Formerly galaxy

    Is BPM part of CE7.1 only? Is EHP CE7.1 required? Is it also available as part of EHP for 7.0?  Please let me know. thanks

  • Does the latest version of Numbers have macros?

    Does the latest version of Numbers include the ability to create macros?  Thanks,

  • How to repair disk permissions inside Time Machine?

    I need to restore my .sites file for iWeb from Time Machine, but when I try I get the following error: "The operation can't be completed because you don't have permission to access some of the items." What IS restored are a few (10 or so) .jpg files

  • WLS6.1 sp3, jms/mq MDB

    Hi           We are using WLS6.1 sp3, accessing MQ through MQ/JMS and Bean managed MDBs. We are managing transaction by throwing Runtime exception and sending the message for requeueing for any issue. We are not using any Messaging bridge approach.