Problem in contacting MXML from ActionScript class catch block
When ever there is a exception inside the ActionScript class , i want to access the MXML TextInputId and dispplay an error Message on to it , but i am unable to succeed.
This is the code i am using
<mx:Application>
<mx:TextInput id="MyTI"/>
</mx:Application>
Inside ActionScript class :
catch(error:Error)
Application.application.MyTI.text="Error Submitting Data"
Need your suggestions to implement this .
Thanks in advance
Hi Kiran,
It should defenitely wor for you...
Try to debug and check whether the control is entering into the catch block.
Thanks,
Bhasker Chari
Similar Messages
-
How to Access MXML components from ActionScript class
Hi ,
I am having a Application Conataner , in which i am having a Form Container with some Label in it .
This is some thing similar to this as shown :
<Mx:Application>
<Mx:Form>
<Mx:Label text="Hello world"/>
</Mx:Form>
</Mx:Application>
Can any body please let me know how can i access this Form's Label , from an ActionScript class .
catch(error:*)
// Here i want to access these Objects and set data to that Label .
Basically My requirement is that iinside the catch block of my ActionScript class , i want to set some text to the Label , Please
let me know if this is possible or not also ??
Waiting for your Replies .Hi these both are not same these refer to different one...
Well let me explain...
Application.application.myCustomComp.myLabel.text = "sometext"; sets the label "myLabel" which is present inside your customcomponent(which is in main application).
Application.application.myLabel.text = "sometext"; sets the label "myLabel" which is present directly inside your main application.
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Label id="myLabel" text=""/> // So inorder to set the label(myLabel) present here you will use directly the 2nd line of code.
<mx:CustomComp id="myCustomComp" /> // So inorder to set the label(myLabel) present inside this component you use 1st line of code.
</mx:Application>
Hope now its clear.
If this post answers your question or helps, please kindly mark it as such.
Thanks,
Bhasker Chari -
Accessing MXML ArrayCollection from ActionScript class?
I have an MXML file that has an arraycollection for my Tree
component. I am overriding the updateDisplayList function in order
to add lines to all of my nodes in the Tree.. however I can't seem
to figure out how to access that ArrayCollection from inside the
actionscript class?
I have tried the methods used to pass variables between two
MXML files (like a popup window - which I have used in the past and
it works great).
My actionscript class code is almost identical to this
example here:
http://www.iepl.net/treeControlSample/treeControlSample.html
In the above example the data is static, but my data is going
to change sometimes and I need access to the entire dataProvider
(ArrayCollection) in order to make the lines work right.. this has
been very frustrating for me! :)
if anyone knows of a better way to achieve gettign lines to
the siblings in a Tree.. please let me know!
Any help would be super duper awesome!I have found the solution to this. My problem was similar to
the one cheftimo was having in this post:
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=60&catid=585&threadid =1367784&enterthread=y
The answer is to import mx.core.Application into the
component you are trying to access the variable from and then call
it by using 'Application.application.<var name>'
Thanks to Greg Lafrance! -
Sending tile messages from ActionScript classes
The majority of my code resides in Actionscript classes, not in the MXML tiles themselves. Do you have an example of an Actionscript class with (or without?) a reference to the tile sending/receiving a message to the composite application?
Thanks!You will have to pass in the MosaicApp reference if you want to actually have the class register a listener or send messages, something as simple as this:
import com.adobe.mosaic.om.interfaces.IApplication;
import com.adobe.mosaic.om.events.Message;
public class Sample
private var mosaicApp : IApplication;
public function Sample(app:IApplication)
public function sendIt() {
var msg:Message = new Message("someNamespace", "someEvent", "Hello tile");
mosaicApp.sendMessage(msg);
Lee Burch -
How to refer mxml in Actionscript class.
hello friends,
I have created small application for login in flex desktop application. In which I am refering webservice method for login for this have created the Authentication class. Now I want to refer different Textinput value for mobile no and Textinput value for password. In my Authentication class.
for this I have created the object of mxml class.And using this I am getting the mobile no value and password value in My Action script class.
This my code :-
SBTS.mxml file
<?xml version="1.0" encoding="utf-8"?>
<!-- usingas/AccessingPackagedClasses.mxml -->
<mx:WindowedApplication
xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
public
function login():void
var User:Authentication;User =
new Authentication();User.authentication();
]]>
</mx:Script>
<mx:Panel width="100%" height="100%" layout="absolute">
<mx:TabNavigator width="100%" height="100%" id="viewstack2">
<mx:Form label="Login Form" id="loginform">
<mx:FormItem label="Mobile no:">
<mx:TextInput id="mobileno"/>
</mx:FormItem>
<mx:FormItem label="Password:">
<mx:TextInput displayAsPassword="true" id="password" />
</mx:FormItem>
<mx:FormItem>
<mx:Button label="Login" click="login()"/>
</mx:FormItem>
</mx:Form>
<mx:Form label="Child List">
<mx:Label width="100%" color="blue" text="
Select Child."/>
</mx:Form>
</mx:TabNavigator>
</mx:Panel>
</mx:WindowedApplication>
Action script class :-
package
src{
import adobe.utils.XMLUI;
import generated.webservices.*;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.rpc.events.FaultEvent;
public class Authentication{
Bindable]
private var childName:ArrayCollection;[
Bindable]
private var childId:ArrayCollection;
private var photoFeed:ArrayCollection;
private var arrayOfchild:Array;
private var newEntry:GetSBTSMobileAuthentication;
public var user:SBTSWebService;
public var mxmlobj:SBTS;
public function authentication():void
user =
new SBTSWebService();
if(user!=null){
user.addSBTSWebServiceFaultEventListener(handleFaults);
user.addgetSBTSMobileAuthenticationEventListener(authenticationResult);
newEntry =
new GetSBTSMobileAuthentication();
if(newEntry!=null){
mxmlobj =
new SBTS();
if(mxmlobj != null){
newEntry.mobile = mxmlobj.mobileno.text; // Getting error here error mention below
newEntry.password= mxmlobj.password.text;
user.getSBTSMobileAuthentication(newEntry);
public function handleFaults(event:FaultEvent):void
Alert.show(
"A fault occured contacting the server. Fault message is: " + event.fault.faultString);}
public function authenticationResult(event:GetSBTSMobileAuthenticationResultEvent):void{
if(event.result != null && event.result._return>0){
if(event.result._return > 0){
var UserId:int = event.result._return;
if(mxmlobj != null){
mxmlobj.loginform.enabled =
false;
mxmlobj.viewstack2.selectedIndex=1;
else{
Alert.show(
"Authentication fail");}
I am getting this error :-
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at SBTSBusineesObject::Authentication/authentication()[E:\Users\User1\Documents\Flex Builder 3\SBTS\src\SBTSBusineesObject\Authentication.as:35]
at SBTS/login()[E:\Users\User1\Documents\Flex Builder 3\SBTS\src\SBTS.mxml:12]
at SBTS/___SBTS_Button1_click()[E:\Users\User1\Documents\Flex Builder 3\SBTS\src\SBTS.mxml:27]
please help me to remove this error.You said :
if(newEntry!=null)
mxmlobj =
new SBTS();
if(mxmlobj != null)
newEntry.mobile = mxmlobj.mobileno.text; // Getting error here error mention below
newEntry.password= mxmlobj.password.text;
//------ Your rest of code
but SBTS is you top WindowApplication mxml object. So saying
mxmlobj = new SBTS();
will create new Instance of SBTS class and not contain your original value shown in UI.
You can do this by saying
<mx:Script>
<![CDATA[
public
function login():void
var User:Authentication;
User = new Authentication();
User.authentication(this); // note we have passed reference of SBTS class
]]>
</mx:Script>
Now modify your class Authentication like
public function authentication(inSbts:SBTS):void
mxmlobj = inSbts // assign the refernce here
user = new SBTSWebService();
------------ Your Original Code --------------------------------------
if(newEntry!=null)
//mxmlobj = new SBTS(); no need of doing this as we have reference of window application/UI
if(mxmlobj != null)
newEntry.mobile = mxmlobj.mobileno.text; // Since mxmlObj is already added to stage to will not any error
newEntry.password= mxmlobj.password.text;
---- -------------------Your rest of code -------------------------------------------------
Now you are done, and hope this will solve your problem.
Cheers
-Vikash -
Problem using repaint() method from another class
I am trying to make tower of hanoi...but unable to transfer rings from a tower to another...i had made three classes....layout21 where all componentents of frame assembled and provided suitable actionlistener.....second is mainPanel which is used to draw the rods n rings in paintComponent.....and third is tower in which code for hanoi is available...i had made an object of mainPanel at layoout21 n tower but i m not able to call repaint from tower..gives an error : cannot find the symbol....method repaint in tower.
code fragments od three classes are:
LAYOUT21
class layout21 extends JFrame implements ActionListener
{ private Vector rod1 = new Vector();
private Vector rod2 = new Vector();
private Vector rod3 = new Vector();
private String elem; //comment
public String r22;
public boolean in=false;
public int count=0; //no of times the transfer to other rods performed
private int r3,rings; // current no of rings
private JComboBox nor,col;
private JLabel no;
private JLabel moved;
private JLabel no1;
private JButton start;
private JButton ref;
private AboutDialog dialog;
private JMenuItem aboutItem;
private JMenuItem exitItem;
private tower t;
final mainPanel2 p =new mainPanel2();
public layout21()
{ t = new tower();
Toolkit kit =Toolkit.getDefaultToolkit();
Image img = kit.getImage("java.gif");
setIconImage(img);
setTitle("Tower Of Hanoi");
setSize(615,615);
setResizable(false);
setBackground(Color.CYAN);
JMenuBar mbar = new JMenuBar();
setJMenuBar(mbar);
JMenu fileMenu = new JMenu("File");
mbar.add(fileMenu);
aboutItem = new JMenuItem("About");
aboutItem.addActionListener(this);
fileMenu.add(aboutItem);
exitItem = new JMenuItem("Exit");
exitItem.addActionListener(this);
fileMenu.add(exitItem);
Container contentPane =getContentPane();
JPanel bspanel = new JPanel();
JPanel bnpanel = new JPanel();
setBackground(Color.CYAN);
//JComboBox
nor = new JComboBox();
nor.setEditable(false);
nor.addItem("3");
nor.addItem("4");
nor.addItem("5");
nor.addItem("6");
nor.addItem("7");
nor.addItem("8");
nor.addItem("9");
bspanel.add(nor);
col = new JComboBox();
col.setEditable(false);
col.addItem("BLACK");
col.addItem("GREEN");
col.addItem("CYAN");
bspanel.add(col);
JLabel tl = new JLabel("Time");
tl.setFont(new Font("Serif",Font.BOLD,12));
bspanel.add(tl);
JTextField tlag = new JTextField("0",4);
bspanel.add(tlag);
start =new JButton("Start");
bspanel.add(start);
ref =new JButton("Refresh");
bspanel.add(ref);
JButton end =new JButton("End");
bspanel.add(end);
start.addActionListener(this);
nor.addActionListener(this);
col.addActionListener(this);
ref.addActionListener(this);
end.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose(); // Closes the dialog
contentPane.add(bspanel,BorderLayout.SOUTH);
JLabel count = new JLabel("No of Transfer reguired:");
count.setFont(new Font("Serif",Font.BOLD,16));
bnpanel.add(count);
no = new JLabel("7");
no.setFont(new Font("Serif",Font.BOLD,16));
bnpanel.add(no);
JLabel moved = new JLabel("Moved:");
moved.setFont(new Font("Serif",Font.BOLD,16));
bnpanel.add(moved);
no1 = new JLabel("0");
no1.setFont(new Font("Serif",Font.BOLD,16));
bnpanel.add(no1);
contentPane.add(bnpanel,BorderLayout.NORTH);
contentPane.add(p,BorderLayout.CENTER);
String r = (String)nor.getSelectedItem();
rings = Integer.valueOf(r).intValue();
p.draw(rings,1) ;
public void actionPerformed(ActionEvent evt)
{ Object source = evt.getSource();
if(source == start)
r3 = Integer.valueOf((String)nor.getSelectedItem()).intValue();
p.transfer(false);
t.initialise(rod1,rod2,rod3,0);
t.towerOfHanoi(r3);
//repaint();
if(source == ref)
{ rod1.removeAllElements() ;
rod2.removeAllElements() ;
rod3.removeAllElements() ;
count=0;
r3 = Integer.valueOf((String)nor.getSelectedItem()).intValue();
p.draw(r3,1);
p.transfer(true);
no1.setText(""+0);
p.trans_vec(rod1,rod2,rod3);
t.initialise(rod1,rod2,rod3,0);
System.out.println("");
repaint();
if(source == nor)
{ JComboBox j = (JComboBox)source;
String item = (String)j.getSelectedItem();
int ring1 = Integer.valueOf(item).intValue();
int a=1;
for(int i=1;i<=ring1;i++)
{ a = a*2;
a=a-1;
no.setText(""+a);
p.draw(ring1,1);
repaint();
if(source == aboutItem)
{ if (dialog == null) // first time
dialog = new AboutDialog(this);
dialog.setVisible(true);
if(source == exitItem)
{ System.exit(0);
if (source==col)
{ JComboBox j = (JComboBox)source;
String item = (String)j.getSelectedItem();
repaint();
TOWER
class tower extends Thread
{ private Vector rod1 = new Vector();
private Vector rod2 = new Vector();
private Vector rod3 = new Vector();
private int count ;
private String elem;
final mainPanel2 z =new mainPanel2();
public void initialise(Vector r1,Vector r2,Vector r3,int c)
{ rod1 = r1;
rod2 = r2;
rod3 = r3;
count =c;
public void towerOfHanoi(int rings)
for(int i=0;i<rings;i++)
rod1.add(" "+(i+1));
System.out.println("rod1:"+rod1.toString());
hanoi(rings,1,2);
public void hanoi(int m,int i, int j)
if(m>0)
{ hanoi(m-1,i,6-i-j);
if(i==1 && j==2 && rod1.isEmpty()==false)
{ count++;
//no1.setText(""+count);
elem = (String)rod1.remove(0);
rod2.add(0,elem);
//z.trans_vec(rod1,rod2,rod3);
repaint(); //NOT ABLE TO USE METHOD HERE...WHY??
//z.hanoi_paint();
try
this.sleep(2000);
catch (Exception e) { e.printStackTrace() ; }
System.out.println(count+". ROD 2:"+rod2.toString());
if(i==1 && j==3 && rod1.isEmpty()==false)
{ count++;
//no1.setText(""+count);
elem = (String)rod1.remove(0);
rod3.add(0,elem);
//z.trans_vec(rod1,rod2,rod3);
repaint();//
// z.hanoi_paint();
try
this.sleep(2000);
catch (Exception e) { e.printStackTrace() ; }
System.out.println(count+". ROD 3:"+rod3.toString());
if(i==2 && j==1 && rod2.isEmpty()==false)
{ count++;
//no1.setText(""+count);
elem = (String)rod2.remove(0);
rod1.add(0,elem);
//z.trans_vec(rod1,rod2,rod3);
repaint();
//z.hanoi_paint();
try
this.sleep(2000);
catch (Exception e) { e.printStackTrace() ; }
System.out.println(count+". ROD 1:"+rod1.toString());
if(i==2 && j==3 && rod2.isEmpty()==false)
{ count++;
//no1.setText(""+count);
elem = (String)rod2.remove(0);
rod3.add(0,elem);
//z.trans_vec(rod1,rod2,rod3);
repaint();
//z.hanoi_paint();
try
this.sleep(2000);
catch (Exception e) { e.printStackTrace() ; }
System.out.println(count+". ROD 3:"+rod3.toString());
if(i==3 && j==1 && rod3.isEmpty()==false)
{ count++;
//no1.setText(""+count);
elem = (String)rod3.remove(0);
rod1.add(0,elem);
//z.trans_vec(rod1,rod2,rod3);
repaint();
//z.hanoi_paint();
try
this.sleep(2000);
catch (Exception e) { e.printStackTrace() ; }
System.out.println(count+". ROD 1:"+rod1.toString());
if(i==3 && j==2 && rod3.isEmpty()==false)
{ count++;
//no1.setText(""+count);
elem = (String)rod3.remove(0);
rod2.add(0,elem);
//z.trans_vec(rod1,rod2,rod3);
repaint();
//z.hanoi_paint();
try
this.sleep(2000);
catch (Exception e) { e.printStackTrace() ; }
System.out.println(count+". ROD 2:"+rod2.toString());
hanoi(m-1,6-i-j,j);
MAINPANEL
class mainPanel2 extends JPanel //throws IOException
public Vector line = new Vector();
public Vector rod11= new Vector();
public Vector rod22= new Vector();
public Vector rod33= new Vector();
public int no_ring;
public int rod_no;
String pixel;
StringTokenizer st,st1;
int x,y;
public boolean initial =true;
public void paintComponent(Graphics g)
{ System.out.println("repaint test");
bresenham(100,60,100,360);
bresenham(101,60,101,360);
bresenham(102,60,102,360);
bresenham(103,60,103,360);
bresenham(104,60,104,360);
g.setColor(Color.BLUE);
while(line.size()>0)
{ pixel = (String)line.remove(0);
st = new StringTokenizer(pixel);
x = Integer.valueOf(st.nextToken()).intValue();
y = Integer.valueOf(st.nextToken()).intValue();
g.drawLine(x,y,x,y);
bresenham(300,60,300,360);
bresenham(301,60,301,360);
bresenham(302,60,302,360);
bresenham(303,60,303,360);
bresenham(304,60,304,360);
while(line.size()>0)
{ pixel = (String)line.remove(0);
st = new StringTokenizer(pixel);
x = Integer.valueOf(st.nextToken()).intValue();
y = Integer.valueOf(st.nextToken()).intValue();
g.drawLine(x,y,x,y);
bresenham(500,60,500,360);
bresenham(501,60,501,360);
bresenham(502,60,502,360);
bresenham(503,60,503,360);
bresenham(504,60,504,360);
while(line.size()>0)
{ pixel = (String)line.remove(0);
st = new StringTokenizer(pixel);
x = Integer.valueOf(st.nextToken()).intValue();
y = Integer.valueOf(st.nextToken()).intValue();
g.drawLine(x,y,x,y);
bresenham(0,361,615,361);//used to get a pixel according to algo.. . func not provided
bresenham(0,362,615,362);
bresenham(0,363,615,363);
bresenham(0,364,615,364);
bresenham(0,365,615,365);
while(line.size()>0)
{ pixel = (String)line.remove(0);
st = new StringTokenizer(pixel);
x = Integer.valueOf(st.nextToken()).intValue();
y = Integer.valueOf(st.nextToken()).intValue();
g.drawLine(x,y,x,y);
if(initial==true)
g.setColor(Color.RED);
for(int i = no_ring;i>0;i--)
{ g.drawLine(100-(i*8),360-(no_ring - i)*10,100+(i*8)+5,360-(no_ring - i)*10);
g.drawLine(100-(i*8),359-(no_ring - i)*10,100+(i*8)+5,359-(no_ring - i)*10);
g.drawLine(100-(i*8),358-(no_ring - i)*10,100+(i*8)+5,358-(no_ring - i)*10);
g.drawLine(100-(i*8),357-(no_ring - i)*10,100+(i*8)+5,357-(no_ring - i)*10);
g.drawLine(100-(i*8),356-(no_ring - i)*10,100+(i*8)+5,356-(no_ring - i)*10);
// draw for each rod
//System.out.println("rod11:"+rod11);
//System.out.println("rod22:"+rod22);
//System.out.println("rod33:"+rod33);
int r1 = rod11.size();
int r2 = rod22.size();
int r3 = rod33.size();
String rd1,rd2,rd3;
int r11,r12,r21,r22,r31,r32;
if(initial == false)
{ g.setColor(Color.RED);
while(rod11.size()>0)
{ r12 = rod11.size()-1;
rd1 = (String)rod11.remove(r12);
r11 = Integer.valueOf(rd1).intValue();
g.drawLine(100-((r11+1)*8),360-(r1 - (r11+1))*10,100+((r11+1)*8)+5,360-(r1 - (r11+1))*10);
g.drawLine(100-((r11+1)*8),359-(r1 - (r11+1))*10,100+((r11+1)*8)+5,359-(r1 - (r11+1))*10);
g.drawLine(100-((r11+1)*8),358-(r1 - (r11+1))*10,100+((r11+1)*8)+5,358-(r1 - (r11+1))*10);
g.drawLine(100-((r11+1)*8),357-(r1 - (r11+1))*10,100+((r11+1)*8)+5,357-(r1 - (r11+1))*10);
g.drawLine(100-((r11+1)*8),356-(r1 - (r11+1))*10,100+((r11+1)*8)+5,356-(r1 - (r11+1))*10);
while(rod22.size()>0)
{ g.setColor(Color.RED);
r22 = rod22.size()-1;
System.out.println("TEST *************************:"+r22);
try
// e.printStackTrace();
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr) ;
br.readLine() ;
}catch(Exception f) {}
rd2 = ((String)rod22.remove(r22)).trim();
r21 = Integer.valueOf(rd2).intValue();
g.drawLine(300-((r22+1)*8),360-(r2 - (r22+1))*10,300+((r22+1)*8)+5,360-(r2 - (r22+1))*10);
g.drawLine(300-((r22+1)*8),359-(r2 - (r22+1))*10,300+((r22+1)*8)+5,359-(r2 - (r22+1))*10);
g.drawLine(300-((r22+1)*8),358-(r2 - (r22+1))*10,300+((r22+1)*8)+5,358-(r2 - (r22+1))*10);
g.drawLine(300-((r22+1)*8),357-(r2 - (r22+1))*10,300+((r22+1)*8)+5,357-(r2 - (r22+1))*10);
g.drawLine(300-((r22+1)*8),356-(r2 - (r22+1))*10,300+((r22+1)*8)+5,356-(r2 - (r22+1))*10);
while(rod33.size()>0)
{ g.setColor(Color.RED);
r32 = rod33.size()-1;
rd3 = (String)rod33.remove(r32);
r31 = Integer.valueOf(rd3).intValue();
g.drawLine(500-((r32+1)*8),360-(r3 - (r32+1))*10,500+((r32+1)*8)+5,360-(r3 - (r32+1))*10);
g.drawLine(500-((r32+1)*8),359-(r3 - (r32+1))*10,500+((r32+1)*8)+5,359-(r3 - (r32+1))*10);
g.drawLine(500-((r32+1)*8),358-(r3 - (r32+1))*10,500+((r32+1)*8)+5,358-(r3 - (r32+1))*10);
g.drawLine(500-((r32+1)*8),357-(r3 - (r32+1))*10,500+((r32+1)*8)+5,357-(r3 - (r32+1))*10);
g.drawLine(500-((r32+1)*8),356-(r3 - (r32+1))*10,500+((r32+1)*8)+5,356-(r3 - (r32+1))*10);
why i m not able to use repaint() method in tower class? from where i can use repaint() methodi can't read your code - not formatted with code tags
I have no chance of getting it to compile (AboutDialog class?? p.draw() ??)
here's a basic routine - add a couple of things to this to demonstrate what is not
being redrawn
(compare the readability of below code (using tags) to yours)
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class Testing extends JFrame
public Testing()
setSize(400,300);
setLocation(400,300);
setDefaultCloseOperation(EXIT_ON_CLOSE);
final DrawPanel dp = new DrawPanel();
JButton btn = new JButton("Change Text Location/Repaint");
getContentPane().add(dp,BorderLayout.CENTER);
getContentPane().add(btn,BorderLayout.SOUTH);
btn.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
dp.x = (int)(Math.random()*300);
dp.y = (int)(Math.random()*150)+50;
repaint();}});
public static void main(String[] args){new Testing().setVisible(true);}
class DrawPanel extends JPanel
int x = 50, y = 50;
public void paintComponent(Graphics g)
super.paintComponent(g);
g.drawString("Hello World",x,y);
} -
How to access elements in main.mxml from ActionScript file?
I am having difficulties creating a panel using the Extension Builder SDK. It seems that all the examples explain how to control a CS5 document using a panel, but I have not found any examples of how to control the elements of the panel via the ActionScript. By the way we are using CS Extension Builder SDK with Flash Builder 4. Here is a simple example of were I am getting stuck.
I create a Extension builder project for a PS panel named: "CSExtensionTest". In the main.mxml file a create a button with id="btnPSCode".
File:
main.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" historyManagementEnabled="false">
<mx:Script>
<![CDATA[
Bindable]
private var hostName:String = HostObject.mainExtension;
]]>
</mx:Script>
<mx:VBox height="100%" width="100%" verticalAlign="middle" horizontalAlign="center">
<mx:Button id="btnPSCode" label="Run PS code" click="CSExtensionTestPhotoshop.run()" enabled="{hostName.indexOf('photoshop') > -1}"/>
<mx:Button id="btnJSXCode" label="Run JSX code" click="CSExtensionTestJSX.run()"/>
</mx:VBox>
</mx:Application>
How can i get access to the properties of this element in the CSExtensionTesJSX.as file?
File:
CSExtensionTesJSX.as
package
import com.adobe.csxs.core.CSXSInterface;
import com.adobe.csxs.core.csxs_internal;
import com.adobe.csxs.types.SyncRequestResult;
import mx.binding.utils.BindingUtils;
import mx.core.ButtonAsset;
import mx.core.mx_internal;
import mx.utils.object_proxy;
public class CSExtensionTestJSX
public static function run():void
var myCSXS:CSXSInterface = CSXSInterface.getInstance();
var result:SyncRequestResult = CSXSInterface.instance.evalScript("jsxFunction");
btnPSCode.enabled = false;
I'm getting this error:
I had originally written a panel using a Flex Project and was able to access the properties of the elements of the main.mxml file directly. It seems I can't do that anymore. Am I missing something in the code? Am I missing some type of library? I'm sorry I am not very experienced in Adobe development, but we are trying to get more involved in developing plugins and extensions for CS5. Any help will be greatly appreciated.Opps... My fault. Just figured out waht was missing.
I forgot to enter the following on the funciton line.
public static function run(m:main):void
Again Thank you. -
Problems with data controls from java classes in JSF pages.
Hi! We have a problem in our Application that we are developing with JSF pages using Data Controls generated from facades java classes. When we running a page in debug mode and the page are loading, if we insert a breakpoint in the first line of method referenced in the data control, the execution enter two times in the method, and this is a problem for us. How to solve this?
We are using JDeveloper 11.1.1.2 with ADF faces.You might need to play around with the refresh property of the action binding.
http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/adf_lifecycle.htm#BJECHBHF -
Problems executing vo query from am class
Hi Gurus,
I have a big one right now, when I'm trying to execute VO query throws me an exception "JBO-27122" I wonder if you could tell me what I'm doing wrong, I hope you can help me, I'll be pending to your answer... have a nice one.
let me share you my code:
this is my AM method:
public ArrayList getPlazaSinAlta(RepIndicatorsBean bn) {
ArrayList list = null;
PromedioDiasBean bean = null;
PlazaSinAltaVOImpl vo = null;
try{
vo = (PlazaSinAltaVOImpl)this.am.findViewObject("PlazaSinAltaVO");
vo.clearCache();
vo.setRangeSize(-1);
vo.setWhereClauseParam(0,"'" + bn.getIdPlaza() + "'");
vo.setWhereClauseParam(1,"'" + bn.getFechaSinIni() + "'");
vo.setWhereClauseParam(2,"'" + bn.getFechaSinFin() + "'");
vo.setWhereClauseParam(3,"'" + bn.getFechaAltaIni() + "'");
vo.setWhereClauseParam(4,"'" + bn.getFechaAltaFin() + "'");
System.out.println(vo.getQuery());
vo.executeQuery();
Utils.setVOSize(vo);
Row[] row = vo.getAllRowsInRange();
list = new ArrayList();
for(int i = 0; i < row.length; i++){
PlazaSinAltaVORowImpl vor = (PlazaSinAltaVORowImpl)row;
bean = new PromedioDiasBean(vor);
list.add(bean);
}catch(Exception e){
Utils.sendError(e);
}finally{
if(vo != null){
vo.closeRowSet();
return list;
and here's my VO's query:
SELECT se.IDSINIESTRO,
se.IDSINIESTRO_ORIG,
se.ID_ETAPA_SEGUIMIENTO,
t.IDTIENDA,
t.TIENDA,
t.FORMATOTIENDA AS COMPANIA,
p.IDPLAZA,
p.NOMBREPLAZA,
si.FECHACREACION,
si.FECHASINIESTRO,
(SELECT round(SUM(d.DIAS_TRANSCURRIDOS)/COUNT(*))
FROM xxrlab.xxrlab_sin_siniestro_comp d
INNER JOIN xxrlab.siniestro s
ON (s.IDSINIESTRO = d.IDSINIESTRO)
INNER JOIN xxrlab.xxrlab_seguimiento_siniestro ss
ON (ss.IDSINIESTRO_ORIG = s.IDSINIESTRO)
INNER JOIN xxrlab.plaza p
ON (p.IDPLAZA = s.IDPLAZA)
INNER JOIN xxrlab.tienda t
ON (t.IDTIENDA = s.IDTIENDA)
WHERE p.IDPLAZA = :1
AND s.FECHASINIESTRO BETWEEN :2 AND :3
AND d.CREATION_DATE BETWEEN :4 AND :5 ) AS PATRIMONIAL,
(SELECT round(SUM(d.DIAS_TRANSCURRIDOS)/COUNT(*))
FROM xxrlab.xxrlab_seguimiento_denuncia d
INNER JOIN xxrlab.xxrlab_seguimiento_siniestro ss
ON (ss.IDSINIESTRO = d.IDSINIESTRO)
INNER JOIN xxrlab.siniestro s
ON (s.IDSINIESTRO = ss.IDSINIESTRO_ORIG)
INNER JOIN xxrlab.plaza p
ON (p.IDPLAZA = s.IDPLAZA)
INNER JOIN xxrlab.tienda t
ON (t.IDTIENDA = s.IDTIENDA)
WHERE p.IDPLAZA = :1
AND s.FECHASINIESTRO BETWEEN :2 AND :3
AND d.CREATION_DATE BETWEEN :4 AND :5 ) AS DESPACHO_DENUNCIA,
(SELECT round(SUM(d.DIAS_TRANSCURRIDOS)/COUNT(*))
FROM xxrlab.xxrlab_seguimiento_ctrl_tienda d
INNER JOIN xxrlab.xxrlab_seguimiento_siniestro ss
ON (ss.IDSINIESTRO = d.IDSINIESTRO)
INNER JOIN xxrlab.siniestro s
ON (s.IDSINIESTRO = ss.IDSINIESTRO_ORIG)
INNER JOIN xxrlab.plaza p
ON (p.IDPLAZA = s.IDPLAZA)
INNER JOIN xxrlab.tienda t
ON (t.IDTIENDA = s.IDTIENDA)
WHERE p.IDPLAZA = :1
AND s.FECHASINIESTRO BETWEEN :2 AND :3
AND d.CREATION_DATE BETWEEN :4 AND :5 ) AS CONTROL_INGRESOS,
(SELECT round(SUM(d.DIAS_TRANSCURRIDOS)/COUNT(*))
FROM xxrlab.xxrlab_seguimiento_admtvo d
INNER JOIN xxrlab.xxrlab_seguimiento_siniestro ss
ON (ss.IDSINIESTRO = d.IDSINIESTRO)
INNER JOIN xxrlab.siniestro s
ON (s.IDSINIESTRO = ss.IDSINIESTRO_ORIG)
INNER JOIN xxrlab.plaza p
ON (p.IDPLAZA = s.IDPLAZA)
INNER JOIN xxrlab.tienda t
ON (t.IDTIENDA = s.IDTIENDA)
WHERE p.IDPLAZA = :1
AND s.FECHASINIESTRO BETWEEN :2 AND :3
AND d.CREATION_DATE BETWEEN :4 AND :5 ) AS ADMINISTRATIVO,
(SELECT round(SUM(d.DIAS_TRANSCURRIDOS)/COUNT(*))
FROM xxrlab.xxrlab_seguimiento_tesoreria d
INNER JOIN xxrlab.xxrlab_seguimiento_siniestro ss
ON (ss.IDSINIESTRO = d.IDSINIESTRO)
INNER JOIN xxrlab.siniestro s
ON (s.IDSINIESTRO = ss.IDSINIESTRO_ORIG)
INNER JOIN xxrlab.plaza p
ON (p.IDPLAZA = s.IDPLAZA)
INNER JOIN xxrlab.tienda t
ON (t.IDTIENDA = s.IDTIENDA)
WHERE p.IDPLAZA = :1
AND s.FECHASINIESTRO BETWEEN :2 AND :3
AND d.CREATION_DATE BETWEEN :4 AND :5 ) AS TESORERIA,
(SELECT round(SUM(d.DIAS_TRANSCURRIDOS)/COUNT(*))
FROM xxrlab.xxrlab_seguimiento_despacho d
INNER JOIN xxrlab.xxrlab_seguimiento_siniestro ss
ON (ss.IDSINIESTRO = d.IDSINIESTRO)
INNER JOIN xxrlab.siniestro s
ON (s.IDSINIESTRO = ss.IDSINIESTRO_ORIG)
INNER JOIN xxrlab.plaza p
ON (p.IDPLAZA = s.IDPLAZA)
INNER JOIN xxrlab.tienda t
ON (t.IDTIENDA = s.IDTIENDA)
WHERE p.IDPLAZA = :1
AND s.FECHASINIESTRO BETWEEN :2 AND :3
AND d.CREATION_DATE BETWEEN :4 AND :5 ) AS DESPACHO_TESORERIA
FROM xxrlab.siniestro si
INNER JOIN xxrlab.plaza p
ON (p.IDPLAZA = si.IDPLAZA)
INNER JOIN xxrlab.tienda t
ON (t.IDTIENDA = si.IDTIENDA)
INNER JOIN xxrlab.xxrlab_seguimiento_siniestro se
ON (se.IDSINIESTRO_ORIG = si.IDSINIESTRO)
Best Regards,
mentorDid you check that the VO is set to Oracle Positional?
And: You cannot use the same bind variable multiple times in the query. Older Oracle JDBC drivers allowed you to do that.
But since the ... 10.2 or something drivers ... this is no longer possible.
So, where you previously could do a:
"WHERE STAFF_ID = :1 AND DEPARTMENT = :2 AND MANAGER_ID = :1"
with:
setWhereClauseParam( 0, id );
setWhereClauseParam( 1, dept );
you now need to:
WHERE STAFF_ID = :1 AND DEPARTMENT = :2 AND MANAGER_ID = :3
with a separate:
setWhereClauseParam( 2, id );
Alternatively, you could use named where clause params. There you can repeat the variable in the query.
Sascha -
Problems accessing child swf from parent class
First off: Hi. I'm new - to the forum and to Flash.
I'm currently writing a flash app that requests a XML feed
from a Java controller and loads child swfs into various parts of
the stage based on the settings/URL details received from the XML
feed.
Its nearly there and I've got my head round a couple of weird
things, but theres one thing left that I've found impossible to
solve. Once the loader class has loaded the swf, it can't access
its methods or set its variables and the child can't access the
parent either (or access the parent's variables full stop). From
what I've read this should be possible. Heres some of my code plus
pseudo code:
Note the Panel class is not linked to a symbol and uses
composition to act like a movie clip, rather than inheritance.
quote:
class Panel{
function Panel(owner:MovieClip, insName:String,
depth:Number){
initiates properties etc....
panelMovie = owner.createEmptyMovieClip(insName,depth);
listener.onLoadComplete = mx.utils.Delegate.create(this,
scheduleModule);
loader.addListener(listener);
loader.loadClip(moduleX.url, panelMovie);
function scheduleModule(){
trace(panelMovie.key);
trace(panelMove.keyTest());
panelMovie.key = "dave";
trace(panelMovie.key);
Child swf:
quote:
var key:String = "test";
As you can see I create an empty movieclip which I store a
reference to in this class under the field "panelMovie". I then use
this (instead of target_mc like you might do with an event handler)
to try to access the child swf. The output is:
trace(panelMovie.key); = "test" (Works fine)
trace(panelMove.keyTest()); = (Nothing returned)
panelMovie.key = "dave";
trace(panelMovie.key); = "test" (Previous line = no effect)
Is this something related to using a class? Really would be
preferentially to keep all code outside of the fla.
I've also tried a lot of different combinations of _root,
_parent and _levelx. None of which I truly understand.
Any help would be much appreciated! Plus any good tutorial
links on timeline and referring to objects in it!
(Couldn't find the code tag/button...)>>trace(panelMove.keyTest()); = (Nothing returned)
You have panelMove here instead of panelMovie
Dave -
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/ -
Problem with Contact download from Microsoft Outlook 2003 SP2
For some strange reason that I cannot, for the life of me, figure out; my contact list ( address book ) downloads, but, even though I specified " sort by last name "; some contacts show up sorted by last name and some show up sorted by first name ! Also, some have commas in the name, even though there are no commas in the record in Outlook !
Anybody else have this experience ??I went to edit-preferences-ipod-contacts tab and
selected synchcronize from microsoft outlook and
synchronize all contacts then I select ipod and
update and doesn't syncronize my contacts, outlook
was open by the way.
Any ideas.
same for calendar.
it doesnot work itunes 6.0.5.20 the lattest.
Please help.
the only way that it works if I do it manually where
I have to same my contacts 1 by 1 becuase I can't
export them as .vcf files so I had to same every
contact as a .vcf file in a private folder and then
moved to my ipod as a hard drive use. Which takes to
many steps for a normal user. It should be 1 step
synchonize.
I need ipod engineers to give a hand with this.
Thanks in advance
There it's only two options microsoft outlook and outlook express on the ipod contacts tab. So I chose microsoft outlook, and the answer for what I have in my computer it's Microsoft Outlook 2003.
Thanks,
Rj -
Problem sending Contact details from iPhone 5
Hi,
Was wondering had anyone else noticed this problem.
When I try to send my contact details via a SMS through Share Contact in Contacts I cannot send my updated contact detials to friends via a SMS message. Has anyone else had this problem and any suggestions and tips to fix this would be much appreciated.
Thnaks KAn attached file with a text message is an MMS. SMS is text only.
If you have MMS enabled on your iPhone and you are able to send SMS, contact your carrier regarding a problem with sending MMS. -
Re: problem calling a method from another class
This line here:
app.computeDiscount(ord,tentativeBill);... You are not capturing the returned amount.
double d = app.computeDiscount(ord,tentativeBill);what kind of problem r u facing?
plz highlight the code where u r facing the problem -
Problems migrating contacts' phone numbers from droid HTC to droid 4.
Hello- Advice please. Just bought Droid 4. Set up FB and Gmail accounts with no problems. Contacts migrated from Droid HTC. EXCEPT contact's actual phone numbers. Anyway of getting these numbers back? Thanks!
that's one of the reasons i use backup assistant, for folks with phone numbers & no email from way back, before the upgrade to the droid x in dec '10.
if the numbers were in ba, they should be there. i've used ba for years without any problems.
ba won't do a backup if a contact is in gmail contacts. -
Accesing mxml components from AS class
Hello,
on a CS6 <csxs:CSExtension> how do I refer to a component (say, a Button with id="myButton") in the main view from an Actionscript class?
The equivalent mx: way highlighted here: http://livedocs.adobe.com/flex/3/html/help.html?content=app_container_3.html)
TIA,
DavideApparently, the correct way is: FlexGlobals.topLevelApplication
(it seems like FB has some problems with both com.adobe.photoshop.Application and mx.core.Application.application in the same class - at least it fired a bunch of weird errors to me)
Davide
Maybe you are looking for
-
I need help with this tutorial from the Adobe website
I'm almost done with my flash game which I created with flash pro cc. And i have been looking for tutorials to integrate my game to the Facebook and this is the only one I found. http://www.adobe.com/devnet/games/articles/getting-started-with-faceboo
-
ORA-12560: Protocol adapter error
Hi All, I've installed Oracle Developer 10g and make the Net Configuration Assistant which is successful, but when I run the form it gives me this error: ORA-12560: Protocol adapter error I know this error and solved it before but I forgot how! So ho
-
I have a 2006 MAC Pro intel......Need to upgrade my Graphics card to acess all of the effects in my Final Cut Pro 4 Studio. Hoping I can go with an ATI 5770 since it will also work with FCPX "IF" I ever decide to upgrade to LION and FCPX. I have ha
-
How do I permanently delete a purchase?
How do I permanently delete a purchase?
-
HT1338 Printer Crashes/No Printer Dialog Box
When I select "print" from the file menu nothing happens, for example the program crashes, Error message, then asks if I want to send a crash report If I try to print a doc* document I can succed clicking the Print-symbol and the top bar, but no poss