New to Pic Simualtions

I am fairly new to multisim and completely new for the simulation with the PEAK of the MCU. Multisim supports the PIC16F84 with the C compiler on my machine. Everything I do in this project is to turn on the LED connected to pin RA0 on. The LED does not light even if I put in the code I'm sure lights up. I looked at an example too. Y at - it something wrong with my setup or is it Multisim? My project is attached.

He seemed to have understood the problem. I need buffers of transistor on the pins of output to the LEDs turn on. I think it's funny that I only see a 720mVs when a PIN is high and 300mV when low? Is it true the PIC16F84 chip or is it a bug in multisim?

Tags: NI Software

Similar Questions

  • default values in the new page, picas, even when going to mm in the preferences of the unit

    everytime I open a new document in indesign dialog CC new document shows page measurments picas even thought that I would have changed it and mm in the preferences of the unit. He just comes back again.

    How can I prevent that from happening. I was able to get to workarounds, but its consumption just enough time to do every time I create a new document.

    its really frustrating that I have my job is mainly for printing and I always use mm.

    Change the preferences with no documents open.

    All new documents will have these preferences.

  • new 8600 pics paper up to shootit on the back or jams

    I bought the all in one 8600 anymore. It did not work at all. Gives the message paper tray is empty. It is not the case. I tried the status bar 1/3, 1/2 tray / full line indicated... Have disconnected reconnected power. tried to copy, scan never gets past the paper tray thing. So far I've accomplished nothing. The choices appear in the led screen. So I think it's quite a load.

    I does not solve the problem.

  • Select FTP from the 2nd nic card

    Hello world

    I know there is probably a simple solution for this, but I found no search terms appropriate to find that answer so here goes...

    I have a pc (XPsp3) with two network adapters. Internet access to the system. The 2nd network card (USB) is an internal card that provides only an Ethernet link to a network IP web cam. I know I could use a hub and all that, but the computer lives in a box seal on the top of a building and it's a prototype of a system of low power solar powered, so we do not want to add new components (pics: http://www.flickr.com/photos/timescience/sets/72157623916362084/).  In any case I want images the camera on the internal NETWORK adapter ftp to our server remote timelapse on the outbound internet connection on the other network card. I've set up redirects the port to route the incoming data, but I did have to implement before outgoing routing. I guess it's simple to do. Someone can it tell me how to or point me to a link where its been explained?
    Thank you!
    Tim

    Hello

    Your question is more complex than what is generally answered in the Microsoft Answers forums. It suits better TechNet. Please post your question in the TechNet forums.
  • Problem with PopupScreen.updateLayout)

    Hello guys '

    I have a problem with PopupScreen. I'm doing the cursor on the PopupScreen. This popupScreen includes BitmapField with transparent image. And the main screen is BitmapField larger than the size of the screen. I want to move the cursor (PopupScreen) on the BitmapField.

    You see what I'm doing here. And I found the solution how to move PopupScreen since the last post. Now, I am facing the problem when the cursor (PopupScreen) on the left. In other words, when I move the slider to the left, it is not clear previous position. I don't know why.

    It works fine when moves right.

    And it is not clear the previous, when position moves to the left.

    So, you can see the code that I use.

    import net.rim.device.api.ui.component.*;import net.rim.device.api.ui.container.*;import net.rim.device.api.ui.*;import net.rim.device.api.system.Bitmap;import net.rim.device.api.system.KeyListener;
    
    public class CursorField extends UiApplication {
    
      private InfoPopupScreen progressPopup;    int x = 180;  int y = 120;  ManagedScreen managedScreen;  Bitmap _bitmap1;  Bitmap _bitmap2;  Bitmap _bitmap;   int [] fillTrans = new int[100];
    
      public CursorField() {
    
          _bitmap = Bitmap.getBitmapResource("cursor1.png");        _bitmap1 = Bitmap.getBitmapResource("cursor1.png");       _bitmap2 = Bitmap.getBitmapResource("cursor2.png");
    
          for(int i = 0; i < 100; i++) {         fillTrans[i] = 0xFFFFFF;      }
    
          managedScreen = new ManagedScreen();      pushScreen(managedScreen);    }
    
      private class InfoPopupScreen extends PopupScreen implements KeyListener {
    
          protected void applyTheme() {         //Nothing     }
    
          public boolean keyStatus(int keycode, int time) {         return false;     }
    
          public boolean keyRepeat(int keycode, int time) {         return false;     }
    
          public boolean keyUp(int keycode, int time) {         return false;     }
    
          public InfoPopupScreen(Manager manager){          super(manager);       }
    
          protected boolean navigationMovement(int dx, int dy, int status, int time) {
    
              return true;      }
    
          protected void paintBackground(Graphics graphics) {           graphics.setBackgroundColor(16777215);        }
    
          public void sublayout(int width, int height){         super.sublayout(width, height);           setPosition(x, y);        }
    
          public boolean keyDown(int keycode, int time) {
    
              char key =  net.rim.device.api.ui.KeypadUtil.getKeyChar(keycode, net.rim.device.api.ui.KeypadUtil.MODE_UI_CURRENT_LOCALE);            //To left         if(key == 79 || key == 111) {             x = x - 5;                progressPopup.updateLayout();         }                      if(key == 73 || key == 105) {             x = x + 10;               progressPopup.updateLayout();         }
    
              if(key == net.rim.device.api.system.Characters.ESCAPE) {              this.close();         }         return true;      }
    
          public boolean keyChar(char key, int status, int time) {          return false;     }
    
          public boolean trackwheelRoll(int amount, int status, int time) {         return false;     }
    
          public boolean trackwheelUnclick( int status, int time ) {            return false;     }
    
          public boolean trackwheelClick( int status, int time ) {          super.trackwheelClick(status, time);          return true;      } }
    
      private class ManagedScreen extends MainScreen {      private BitmapField _cursorField;
    
          public ManagedScreen() {
    
              _cursorField = new BitmapField(_bitmap) {             public void paint(Graphics graphics) {                    graphics.setBackgroundColor(16777215);                    super.paint(graphics);                }         };
    
              FlowFieldManager manager = new FlowFieldManager(FlowFieldManager.USE_ALL_HEIGHT | FlowFieldManager.USE_ALL_WIDTH) {               public void paint(Graphics graphics) {                    graphics.setBackgroundColor(16777215);                    super.paint(graphics);                }         };
    
              manager.add(_cursorField);            progressPopup = new InfoPopupScreen(manager);
    
              Bitmap pic = Bitmap.getBitmapResource("background.jpg");          BitmapField picField = new BitmapField(pic);          add(picField);
    
              ButtonField _closeButton = new ButtonField("Push screen", ButtonField.CONSUME_CLICK | ButtonField.FIELD_HCENTER);         _closeButton.setChangeListener(new FieldChangeListener() {                public void fieldChanged(Field field, int context) {                  pushScreen(progressPopup);                }         });
    
              add(_closeButton);        } }
    
      public static void main(String[] args) {      CursorField application = new CursorField();      application.enterEventDispatcher();   }}
    

    I hope you can solve my problem.

    TNX in advance"

    Ttry this...   In paintBackground(), call clear after you set the background color.

  • The application to display very slowly, please give me advice, thanks.

    Dear all,

    Could someone give me some advice? Thanks, I'm new developer in the development of a program administered for BB bold 9000, but when I run the application, it was display very slowly. Thank you.

    My code is displayed as follows:

    Main:

    import net.rim.blackberry.api.browser.Browser;
    import net.rim.blackberry.api.browser.BrowserSession;
    import net.rim.device.api.servicebook.ServiceBook;
    import net.rim.device.api.servicebook.ServiceRecord;
    import net.rim.device.api.system.Characters;
    import net.rim.device.api.system.EncodedImage;
    import net.rim.device.api.ui.Color;
    import net.rim.device.api.ui.DrawStyle;
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.Font;
    import net.rim.device.api.ui.Graphics;
    import net.rim.device.api.ui.UiApplication;
    import net.rim.device.api.ui.component.BitmapField;
    import net.rim.device.api.ui.component.LabelField;
    import net.rim.device.api.ui.container.HorizontalFieldManager;
    import net.rim.device.api.ui.container.MainScreen;
    import net.rim.device.api.ui.container.VerticalFieldManager;
    import net.rim.device.api.ui.decor.Background;
    import net.rim.device.api.ui.decor.BackgroundFactory;
    
    public class SmartoneVodafoneServices extends UiApplication {
    
        public static void main(String arg[]) throws Throwable {
            SmartoneVodafoneServices application = null;
            application = new SmartoneVodafoneServices();
            application.enterEventDispatcher();
        }
    
        public SmartoneVodafoneServices() throws Throwable {
                pushScreen(new SmartoneVodafoneServicesScreen());
        }
    }
    
    class SmartoneVodafoneServicesScreen extends MainScreen {
    
        //private TableLayoutManager table = TableDefine();
        private String url = "http://202.140.96.134:8080/Hero/shortcuts_demo.xml";
        private static ServiceBook sb = ServiceBook.getSB();
        private static ServiceRecord[] records = sb.findRecordsByCid("BrowserConfig");
    
        public SmartoneVodafoneServicesScreen() throws Throwable {
            super();
            LabelField title = new LabelField("Smartone Vodafone Services",
                    DrawStyle.ELLIPSIS | Field.USE_ALL_WIDTH | DrawStyle.HCENTER);
            setTitle(title);
    
            Background bg = BackgroundFactory.createSolidBackground(Color.BLACK);
            getMainManager().setBackground(bg);
            String[][] arr = null;EncodedImage pic = null;int p = 0;
            UiApplication.getUiApplication().getScreenCount();
            arr = Conn.WorkForXML(url);
            HorizontalFieldManager mainHManager = new HorizontalFieldManager(Field.FIELD_VCENTER);
            VerticalFieldManager col1 = new VerticalFieldManager(Field.FIELD_HCENTER);
            VerticalFieldManager col2 = new VerticalFieldManager(Field.FIELD_HCENTER);
            VerticalFieldManager col3 = new VerticalFieldManager(Field.FIELD_HCENTER);
            VerticalFieldManager col4 = new VerticalFieldManager(Field.FIELD_HCENTER);
            VerticalFieldManager col5 = new VerticalFieldManager(Field.FIELD_HCENTER);
    
            for (int i = 0; i < arr.length; i++) {
                if (arr[i][0] != null || arr[i][1] != null || arr[i][2] != null) {      
    
                    LabelField name = showName(arr[i][0]);
                    pic = Conn.GetPngField(arr[i][1]);
                    final String link = arr[i][2];
                    //final String link = "http://202.140.96.134:8080/blackberry/index.html";
                    BitmapField myBitmapField = new BitmapField(pic.getBitmap(),Field.FOCUSABLE|FIELD_VCENTER){
                        protected boolean invokeAction(int status){
                            //BrowserSession site = Browser.getDefaultSession();
                            BrowserSession site = createWAPBrowserSession();
                            site.displayPage(link);
                            return true;
                        }
    
                        protected void paint(Graphics g) {
                            g.setBackgroundColor(Color.BLACK);
                            g.drawRoundRect(0, 0, getWidth(), getHeight(), 10, 10);
                            g.setColor(Color.WHITE);
                            super.paint(g);
    
                        }
                    };
    
                    switch (p) {
                        case 0:
                            col1.add(new LabelField(" ",LabelField.NON_FOCUSABLE));
                            col1.add(myBitmapField);
                            col1.add(name);
                            break;
                        case 1:
                            col2.add(new LabelField(" ",LabelField.NON_FOCUSABLE));
                            col2.add(myBitmapField);
                            col2.add(name);
                            break;
                        case 2:
                            col3.add(new LabelField(" ",LabelField.NON_FOCUSABLE));
                            col3.add(myBitmapField);
                            col3.add(name);
                            break;
                        case 3:
                            col4.add(new LabelField(" ",LabelField.NON_FOCUSABLE));
                            col4.add(myBitmapField);
                            col4.add(name);
                            break;
                        case 4:
                            col5.add(new LabelField(" ",LabelField.NON_FOCUSABLE));
                            col5.add(myBitmapField);
                            col5.add(name);
                            break;
                    }
                    p ++;
                    if ( p == 5 ){
                        p = 0;
                    }
                }
            }
            mainHManager.add(col1);
            mainHManager.add(col2);
            mainHManager.add(col3);
            mainHManager.add(col4);
            mainHManager.add(col5);
            add(mainHManager);
        } 
    
        public LabelField showName(String name) {
            return new LabelField(name,LabelField.NON_FOCUSABLE|LabelField.FIELD_VCENTER){
                protected void paint(Graphics g) {
                    Font myFont = Font.getDefault().derive(Font.PLAIN, 7);
                    g.setColor(Color.WHITE);
                    g.setFont(myFont);
                    super.paint(g);
                }
            };
        }
    
        public static BrowserSession createWAPBrowserSession()
        {
            // If there are browser services found - search for the WAP2
            // Service Record
            String uid = null;
            int numRecords = records.length;
            for( int i = 0; i < numRecords; i++ )
            {
                ServiceRecord myRecord = records[i];
                //if (myRecord.getName()){
                if (myRecord.getUid().equals("WAP Browser Smartone")==true){
                    uid = myRecord.getUid();
                }
            }
            return Browser.getSession(uid);
        }
    
        public boolean keyChar(char key, int status, int time)
           {
               switch (key) {
                   case Characters.ESCAPE:
                        System.exit(0);
                        break;
               }
               return true;
               //return true to indicate that a key was pressed
           }
    }
    

    Conn.Java

    import java.io.*;
    
    import javax.microedition.io.*;
    
    import net.rim.blackberry.api.browser.Browser;
    import net.rim.blackberry.api.browser.BrowserSession;
    import net.rim.device.api.math.*;
    import net.rim.device.api.servicebook.ServiceRecord;
    import net.rim.device.api.system.*;
    import net.rim.device.api.ui.Color;
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.Graphics;
    import net.rim.device.api.ui.XYEdges;
    import net.rim.device.api.ui.component.BitmapField;
    import net.rim.device.api.ui.decor.Border;
    import net.rim.device.api.ui.decor.BorderFactory;
    import net.rim.device.api.xml.parsers.*;
    
    import org.w3c.dom.*;
    
    public class Conn {
    
        /**
         * @return
         * @throws IOException
         * @throws Throwable
         * @throws Throwable
         */
    
        public static String[][] WorkForXML(String url) throws IOException, Throwable {
            // TODO Auto-generated method stub
            String[][] arr = null;
            HttpConnection conn = null;
            Document doc;
    
                conn = (HttpConnection) Connector.open(url);
                conn.setRequestMethod(HttpConnection.GET);
    
            try {
                if (conn.getResponseCode() == HttpConnection.HTTP_OK) {
    
                    DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
                    DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
    
                    docBuilder.isValidating();
                    doc = docBuilder.parse(conn.openInputStream());
                    conn.close();
                    doc.getDocumentElement().normalize();
    
                    NodeList list = doc.getElementsByTagName("item");
                    arr = new String[list.getLength()][3];
    
                    for (int i = 0; i < list.getLength(); i++) {
                        Node nNode = list.item(i);
                        NodeList sList = nNode.getChildNodes();
    
                        if (sList.item(1).getFirstChild().getNodeValue().equals("0")) {
    
                            arr[i][0] = sList.item(3).getFirstChild().getNodeValue();
                            arr[i][1] = sList.item(7).getFirstChild().getNodeValue();
                            arr[i][2] = sList.item(11).getFirstChild().getNodeValue();
    
                        }
                    }
                    conn=null;
                    docBuilderFactory = null;
                    docBuilder = null;
                }
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (ParserConfigurationException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
    
            return arr;
        }
    
        public static EncodedImage GetPngField(String pic) throws IOException {
    
            EncodedImage imageField = null;
            HttpConnection picon = null;
    
                picon = (HttpConnection) Connector.open(pic);
                picon.setRequestMethod(HttpConnection.GET);
    
            try {
                if (picon.getResponseCode() == HttpConnection.HTTP_OK) {
    
                    DataInputStream inputStream = picon.openDataInputStream();
                    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    
                    byte[] buffer = new byte[5120];
                    int len = 0, imageSize = 0;
    
                    while (-1 != (len = inputStream.read(buffer))) {
                        byteArrayOutputStream.write(buffer);
                        imageSize += len;
                    }
    
                    byteArrayOutputStream.flush();
                    picon.close();
                    picon=null;
                    byte[] imageData = byteArrayOutputStream.toByteArray();
                    byteArrayOutputStream.close();
                    byteArrayOutputStream = null;
                    inputStream = null;
                    //imageField = PNGEncodedImage.createEncodedImage(imageData, 0, imageSize);
                    EncodedImage pngImage = PNGEncodedImage.createEncodedImage(imageData, 0, imageSize);
                    imageField = resizeImage(pngImage,55,55);
    
                }
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
    
            return imageField;
        }
    
        public static EncodedImage resizeImage (EncodedImage png,int Height, int Width) {
    
            int currHeight,currWidth,multH = 0,multW = 0;
    
            try {
    
                currHeight = png.getHeight();
                currWidth = png.getWidth();
                multH = Fixed32.div(Fixed32.toFP(currHeight),Fixed32.toFP(Height));
                multW = Fixed32.div(Fixed32.toFP(currWidth),Fixed32.toFP(Width));
    
            } catch (Exception e) {}
    
            return png.scaleImage32(multH,multW);
        }
    }
    

    I have

    hyoryeo wrote:

    Thanks ydarishy & peter_strange, I just point the programmer SR. is not recommended to use the wire in my workplace. But I think that the wire is the good way to make my faster program because I found that the wire would be used in many places in the Blackberry. Then I would practice the Thread in the test project.

    have been changes to the program and use the wire, saw the fastest forward speed. I would add the bar of charge process if necessary of the head. Thanks ydarishy & peter_strange,.

    SmartoneVodafoneServices.java

    import java.util.Vector;
    
    import net.rim.blackberry.api.browser.Browser;import net.rim.blackberry.api.browser.BrowserSession;import net.rim.device.api.servicebook.ServiceBook;import net.rim.device.api.servicebook.ServiceRecord;import net.rim.device.api.system.Characters;import net.rim.device.api.ui.Color;import net.rim.device.api.ui.DrawStyle;import net.rim.device.api.ui.Field;import net.rim.device.api.ui.UiApplication;import net.rim.device.api.ui.component.LabelField;import net.rim.device.api.ui.container.HorizontalFieldManager;import net.rim.device.api.ui.container.MainScreen;import net.rim.device.api.ui.container.VerticalFieldManager;import net.rim.device.api.ui.decor.Background;import net.rim.device.api.ui.decor.BackgroundFactory;
    
    public class SmartoneVodafoneServices extends UiApplication {
    
       public static void main(String arg[]) throws Throwable {      SmartoneVodafoneServices application = null;      application = new SmartoneVodafoneServices();     application.enterEventDispatcher();   }
    
       public SmartoneVodafoneServices() throws Throwable {          pushScreen(new SmartoneVodafoneServicesScreen()); }}
    
    class SmartoneVodafoneServicesScreen extends MainScreen {
    
      private String url = "http://202.140.96.134:8080/Hero/shortcuts_demo.xml";
    
      private static ServiceBook sb = ServiceBook.getSB();  private static ServiceRecord[] records = sb.findRecordsByCid("BrowserConfig");    private HorizontalFieldManager mainHManager = new HorizontalFieldManager(Field.FIELD_VCENTER);    private VerticalFieldManager colum1 = new VerticalFieldManager(Field.FIELD_HCENTER);  private VerticalFieldManager colum2 = new VerticalFieldManager(Field.FIELD_HCENTER);  private VerticalFieldManager colum3 = new VerticalFieldManager(Field.FIELD_HCENTER);  private VerticalFieldManager colum4 = new VerticalFieldManager(Field.FIELD_HCENTER);  private VerticalFieldManager colum5 = new VerticalFieldManager(Field.FIELD_HCENTER);
    
        private Vector col = new Vector();
    
      public SmartoneVodafoneServicesScreen() throws Throwable {        super();      LabelField title = new LabelField("Smartone Vodafone Services",               DrawStyle.ELLIPSIS | Field.USE_ALL_WIDTH | DrawStyle.HCENTER);        setTitle(title);      col.addElement(colum1);col.addElement(colum2);col.addElement(colum3);col.addElement(colum4);col.addElement(colum5);       Background bg = BackgroundFactory.createSolidBackground(Color.BLACK);     getMainManager().setBackground(bg);       SmartoneVodafoneServicesScreen screen = this;     ConnectXMLThread startMainThread = new ConnectXMLThread(url,col,mainHManager, screen);        startMainThread.start();      //startMainThread.wait(30000);
    
      } 
    
      public BrowserSession createWAPBrowserSession()   {     // If there are browser services found - search for the WAP2      // Service Record     String uid = null;        int numRecords = records.length;      for( int i = 0; i < numRecords; i++ )      {         ServiceRecord myRecord = records[i];          if (myRecord.getUid().equals("WAP Browser Smartone")==true){              uid = myRecord.getUid();          }     }     return Browser.getSession(uid);   } public boolean keyChar(char key, int status, int time)       {         switch (key) {            case Characters.ESCAPE:                    System.exit(0);                   break;           }         return true;          //return true to indicate that a key was pressed      }}
    

    ConnectXMLThread.java

    import java.util.Vector;
    
    import javax.microedition.io.Connector;import javax.microedition.io.StreamConnection;
    
    import net.rim.device.api.ui.UiApplication;import net.rim.device.api.ui.container.HorizontalFieldManager;import net.rim.device.api.ui.container.VerticalFieldManager;import net.rim.device.api.xml.parsers.DocumentBuilder;import net.rim.device.api.xml.parsers.DocumentBuilderFactory;
    
    import org.w3c.dom.Document;import org.w3c.dom.Node;import org.w3c.dom.NodeList;
    
    public class ConnectXMLThread extends Thread {
    
      private StreamConnection conn;    private Document doc; private Vector vector = new Vector(); private String url;   private Vector col;   private HorizontalFieldManager mainHManager;  private SmartoneVodafoneServicesScreen screen;
    
      //public ConnectXMLThread(long startApplication) {    public ConnectXMLThread(String url, Vector col, HorizontalFieldManager mainHManager, SmartoneVodafoneServicesScreen screen) {     // TODO Auto-generated constructor stub       //this.starttime = startApplication;      this.url = url;       this.col = col;       this.mainHManager = mainHManager;     this.screen = screen;
    
       }
    
       public void run() {       try {         conn = (StreamConnection) Connector.open(url);            DocumentBuilderFactory docFac = DocumentBuilderFactory.newInstance();         DocumentBuilder docBui = docFac.newDocumentBuilder();         doc = docBui.parse(conn.openInputStream());           NodeList list = doc.getElementsByTagName("item");
    
               for (int i = 0; i < list.getLength(); i++) {               Node nNode = list.item(i);                NodeList sList = nNode.getChildNodes();
    
                 if (sList.item(1).getFirstChild().getNodeValue().equals("0")) {                   String[] arr = new String[3];                 arr[0] = sList.item(3).getFirstChild().getNodeValue();                    arr[1] = sList.item(7).getFirstChild().getNodeValue();                    arr[2] = sList.item(11).getFirstChild().getNodeValue();                   vector.addElement(arr);               }         }         Vector threadList = new Vector(vector .size());           for (int i = 0; i < vector.size(); i++) {              String[] arr = (String[]) vector.elementAt(i);                String img = arr[1];              String url = arr[2];
    
                    ConnectPNGThread requestThread = new ConnectPNGThread(img, url, i,col,screen);                requestThread.start();
    
                  threadList.addElement(requestThread);
    
               }
    
               //System.out.println("Wait for threads to complete");         boolean isComplete = false;           while (!isComplete) {             // NetworkThread.sleep(500);              for (int i = 0; i < threadList.size(); i++) {                  if (((ConnectPNGThread) threadList.elementAt(i)).isAlive()) {                     isComplete = false;                       break;                    }                 if (i == threadList.size() - 1) {                     isComplete = true;                    }             }         }         //final long endApplication = System.currentTimeMillis();         UiApplication.getUiApplication().invokeLater(new Runnable() {             public void run() {                   for (int num = 0; num < 5; num++) {                        mainHManager.add((VerticalFieldManager) col.elementAt(num % 5));                  }                 screen.add(mainHManager);                 //Dialog.alert(Long.toString((endApplication - starttime)));              }         });
    
             System.out.println("All threads are complete");       } catch (Exception e) {
    
         }
    
       }
    
    }
    

    ConnectPNGThread

    import java.io.ByteArrayOutputStream;import java.io.DataInputStream;import java.util.Vector;
    
    import javax.microedition.io.Connector;import javax.microedition.io.StreamConnection;
    
    import net.rim.blackberry.api.browser.BrowserSession;import net.rim.device.api.system.EncodedImage;import net.rim.device.api.system.PNGEncodedImage;import net.rim.device.api.ui.Color;import net.rim.device.api.ui.Field;import net.rim.device.api.ui.Graphics;import net.rim.device.api.ui.component.BitmapField;import net.rim.device.api.ui.component.LabelField;import net.rim.device.api.ui.container.VerticalFieldManager;
    
       public class ConnectPNGThread extends Thread {
    
          private StreamConnection picon;       private int p;        private Vector col;       private String img;       private String url;       private SmartoneVodafoneServicesScreen screen;
    
            public ConnectPNGThread(String img, String url, int i, Vector col, SmartoneVodafoneServicesScreen screen) {           // TODO Auto-generated constructor stub           super();          this.img = img;           this.url = url;           this.p = i%5;         this.col = col;           this.screen = screen;     }
    
         public void run() {       //public NetworkThread() {            try {             picon = (StreamConnection) Connector.open(img);               DataInputStream inputStream = picon.openDataInputStream();                ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();                byte[] buffer = new byte[5120];               int len = 0, imageSize = 0;               while (-1 != (len = inputStream.read(buffer))) {                  byteArrayOutputStream.write(buffer);                  imageSize += len;             }             picon.close();                byteArrayOutputStream.flush();                byte[] imageData = byteArrayOutputStream.toByteArray();               final EncodedImage pngImage = PNGEncodedImage.createEncodedImage(imageData, 0, imageSize);                final BitmapField myBitmapField = new BitmapField(pngImage                        .getBitmap(), Field.FIELD_VCENTER | Field.FOCUSABLE) {                    protected boolean invokeAction(int status) {                      // BrowserSession site = Browser.getDefaultSession();                     BrowserSession site = screen.createWAPBrowserSession();                       site.displayPage(url);                        return true;                  }
    
                       protected void paint(Graphics g) {                        g.setBackgroundColor(Color.BLACK);                        g.drawRoundRect(0, 0, getWidth(), getHeight(), 10, 10);                       g.setColor(Color.WHITE);                      super.paint(g);
    
                     }
    
                   };
    
                  VerticalFieldManager c = (VerticalFieldManager) col.elementAt(p);             c.add(new LabelField(" ", LabelField.NON_FOCUSABLE));             c.add(myBitmapField);
    
                  } catch (Exception e) {               //e.printStackTrace();                System.out.println(e.toString());         }     }
    
        }
    
    
    
  • java.lang.IllegalStateException: setPosition called outside the layout

    Hello guys '

    Good day. I try to spend PopupScreen and posted about this before.

    But I can't solve. You can see what I do from here.

    At the request of work, throws exception: java.lang.IllegalStateException: setPosition called outside the layout

    I use following code:

    import net.rim.device.api.ui.component.*;import net.rim.device.api.ui.container.HorizontalFieldManager;import net.rim.device.api.ui.container.MainScreen;import net.rim.device.api.ui.container.PopupScreen;import net.rim.device.api.ui.*;import net.rim.device.api.system.Bitmap;import net.rim.device.api.system.KeyListener;
    
    public class CursorField extends UiApplication {
    
      private InfoPopupScreen progressPopup;    int x = Graphics.getScreenWidth() / 3;    int y = Graphics.getScreenHeight() / 2;
    
      public CursorField() {
    
          ManagedScreen managedScreen = new ManagedScreen();        pushScreen(managedScreen);    }
    
      private class InfoPopupScreen extends PopupScreen implements KeyListener {
    
          protected void applyTheme() {         //Nothing     }
    
          public boolean keyStatus(int keycode, int time) {         return false;     }
    
          public boolean keyRepeat(int keycode, int time) {         return false;     }
    
          public boolean keyUp(int keycode, int time) {         return false;     }
    
          public InfoPopupScreen(Manager manager){          super(manager);       }
    
          protected boolean navigationMovement(int dx, int dy, int status, int time) {
    
              return true;      }
    
          protected void paintBackground(Graphics graphics) {           graphics.setBackgroundColor(16777215);        }
    
          public void sublayout(int width, int height){         super.sublayout(width, height);           setPosition(x, y);        }
    
          public boolean keyDown(int keycode, int time) {
    
              char key =  net.rim.device.api.ui.KeypadUtil.getKeyChar(keycode, net.rim.device.api.ui.KeypadUtil.MODE_UI_CURRENT_LOCALE);
    
              //Letter 'I'          if(key == 73) {               x = x + 10;               try {                 this.setPosition(x, y);              } catch(Exception e) {                    System.out.println("Exception : " + e.toString());                }         }
    
              if(key == net.rim.device.api.system.Characters.ESCAPE) {              this.close();         }         return true;      }
    
          public boolean keyChar(char key, int status, int time) {          return false;     }
    
          public boolean trackwheelRoll(int amount, int status, int time) {         return false;     }
    
          public boolean trackwheelUnclick( int status, int time ) {            return false;     }
    
          public boolean trackwheelClick( int status, int time ) {          super.trackwheelClick(status, time);          return true;      } }
    
      private class ManagedScreen extends MainScreen {      private BitmapField _cursorField;     private Bitmap _bitmap;
    
          public ManagedScreen() {
    
              _bitmap = Bitmap.getBitmapResource("cursor.png");         int[] a = new int [10 * 10];          _bitmap.getARGB(a, 0, 10, 0, 0, 10, 10);
    
              _cursorField = new BitmapField(_bitmap) {             public void paint(Graphics graphics) {                    graphics.setBackgroundColor(16777215);                    super.paint(graphics);                }         };
    
              HorizontalFieldManager manager = new HorizontalFieldManager(USE_ALL_WIDTH) {              public void paint(Graphics graphics) {                    graphics.setBackgroundColor(16777215);                    super.paint(graphics);                }         };
    
              manager.add(_cursorField);            progressPopup = new InfoPopupScreen(manager);
    
              Bitmap pic = Bitmap.getBitmapResource("background.jpg");          BitmapField picField = new BitmapField(pic);          add(picField);
    
              ButtonField _closeButton = new ButtonField("Push screen", ButtonField.CONSUME_CLICK | ButtonField.FIELD_HCENTER);         _closeButton.setChangeListener(new FieldChangeListener() {                public void fieldChanged(Field field, int context) {                  pushScreen(progressPopup);                }         });
    
              add(_closeButton);        } }
    
      public static void main(String[] args) {      CursorField application = new CursorField();      application.enterEventDispatcher();   }}
    

    I don't know what is the problem here.

    Please help me guys

    TNX in advance"

    You can only call layout() setPosition or sublayout().

    Try this...

    Subclass sublayout() and put your good standing in position one.  Once you update your x / call updateLayout().

  • browseForOpen only works in the essay film

    Greetings,

    I'm here to ask some basic help.


    I have this code embedded in a .fla Adobe Air 2:

    import flash.filesystem.File;
    import flash.events.MouseEvent;
    import flash.events.Event;
    
    var fileChooser:File = File.userDirectory;
    
    function doSelect(e:Event):void
    {
         trace (e.target.nativePath);
         var pic:Loader = new Loader();
         pic.load(new URLRequest(e.target.nativePath));
         addChild(pic);
          pic.y+=40;
    }
    fileChooser.browseForOpen("Open");
    fileChooser.addEventListener(Event.SELECT, doSelect);
    

    When I test the movie (control-enter style ^^) I can see the browser window appears but when I publish the swf version and exe the browseforopen simply does not work without any errors.

    Is this something simple and noobish I miss?

    Thank you very much in advance

    Air creates the .air, not .swf or .exe file. Test with the .air file.

  • Larger image loading and when dropped

    Hey.  I'm working on this image clipping, where the thumbnails of the images are displayed.  I get each image

    function urlLoaded(event:Event):void {
         urlLoader.removeEventListener(Event.COMPLETE,urlLoaded);
         xml=XML(event.target.data);
         xmlList=xml.children();
    
         for (var i:int=0; i<xmlList.length(); i++) {
              var thumb:Thumbnail=new Thumbnail(xmlList[i].url);
              arrayThumb.push(thumb);
              arrayThumb[i].y=150.5;
              arrayThumb[i].x=i*110+280;
              photoContainer.addChild(thumb);
              arrayThumb[i].addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
              arrayThumb[i].addEventListener(MouseEvent.MOUSE_UP, dropIt);
         }
    }
    

    And I pick and drop off the thumbnail image

    function pickUp(event:MouseEvent):void {
         getPosition(event.target);
         stage.addChild(event.target as DisplayObject);
         Sprite(event.target).startDrag(true);
    }
    
    function dropIt(event:MouseEvent):void {
         Sprite(event.target).stopDrag();
    
         if (event.target.hitTestObject(getChildByName("movie"))) {
              var my_loader:Loader = new Loader();
              my_loader.load(new URLRequest("pics/1.png"));
              movie.addChild(my_loader);
              this.photoContainer.addChild(event.target as DisplayObject);
              event.target.x=xPos;
              event.target.y=yPos;
         } else {
              this.photoContainer.addChild(event.target as DisplayObject);
              event.target.x=xPos;
              event.target.y=yPos;
         }
    }
    

    Now, it's perfect, because if the image is not filed in the clip, called 'film', it will be placed in the dial in the correct position.  I have just a coupld of questions currently.  I don't want pics/1.png to appear on every drop, this was used for a test.  What I need is for each image of the "big picture to display, all of which have the same name as the smaller image, just in a different folder.  The images are in the xml as file

    <image>
          <url>pics/img_1.png</url>
      </image>
    

    So is there anyway I could use the code above to load the image large associated with the small image?  If event.target points to the current tile picked up, I could do something like event.target.url to point to his name or something?

    Any advice appreciated

    You should be able to store the filename as a variable of the thumbnail image and then use it when it comes to loading the image, as in...

    my_loader. Load (new URLRequest("pics/"+event.target.variable));

  • Repeat code

    Hello.  So I have this code that loads an xml file

    var urlRequest:URLRequest = new URLRequest("pics.xml");
    var urlLoader:URLLoader = new URLLoader();
    var xml:XML;
    var xmlList:XMLList;urlLoader.load(urlRequest);
    urlLoader.addEventListener(Event.COMPLETE,urlLoaded);
    
    function urlLoaded(event:Event):void {
         xml = XML(event.target.data);
         xmlList = xml.children();
         trace(xmlList.length());
         for (var i:int=0; i<xmlList.length(); i++) {
              var thumb:Thumbnail = new Thumbnail(xmlList[i].url);
              arrayThumb.push(thumb);
              arrayThumb[i].y = 67.5;
              arrayThumb[i].x = i*100+55;
              photoContainer.addChild(thumb);
         }
    }
    

    I want to have several buttons however charge a different xml file, not only use a single file.  Would this mean I have to recreate the above code for each button, or is anyway that I could reuse?

    see you soon

    use:

    var xml:XML;

    var xmlList:XMLList

    function loadXML(xmlS:String):void{var urlRequest:URLRequest = new URLRequest(xmlS);var urlLoader:URLLoader = new URLLoader();urlLoader.load(urlRequest);urlLoader.addEventListener(Event.COMPLETE,urlLoaded);}
    
     function urlLoaded(event:Event):void {     xml = XML(event.target.data);     xmlList = xml.children();     trace(xmlList.length());     for (var i:int=0; i
    
  • How can I store bitmap data in the SharedObject class?

    Any ideas?

    What I tried to do. First run the "code" then the "Second code '.

    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:Script>
         <![CDATA[
              import mx.controls.Image;
              private function init():void
              {
                   var o:SharedObject = SharedObject.getLocal("t1","/");
                   
                   //First code
                   o.clear();
                   var bit:Bitmap= new Bitmap(new BitmapData(100,100,false,0));
                   o.data.bit=bit;
                   o.flush();
                   
                   //Second code               
                   var bit:Bitmap = o.data.bit;
                   var pic:Image = new Image();
                   pic.source=bit;
                   Application.application.addChild(pic);
                   
                   
              }
         ]]>
    </mx:Script>     
    </mx:Application>
    

    godilya,

    Sorry about that. Since there were a lot of mistakes in your code I just fixed all. But you are right that even after he still not actually saved it to the SO.

    I would recommend saving them as a ByteArray, that appears in literature as one of the supported by the SharedObject object classes.

    First code

    var bitmap: Bitmap = new Bitmap (BitmapData (100,100,false,0xFF0000) new);

    var bitmapData:BitmapData = bitmap.bitmapData;

    var byteArray:ByteArray = bitmapData.getPixels (bitmapData.rect);

    so. Clear();

    so.data.byteArray = byteArray;

    so. Data.Width = bitmapData.rect.width;

    so. Data.Height = bitmapData.rect.height;

    so. Flush();

    Second code

    var byteArray:ByteArray = ByteArray (so.data.byteArray);

    var bitmapData:BitmapData = new BitmapData (so.data.width, so.data.height);

    bitmapData.setPixels (bitmapData.rect, byteArray);

    var bitmap: Bitmap = new Bitmap (bitmapData);

    Photo: Image of var = new Image();

    PIC.source = bitmap;

    Application.application.addChild (pic);

    I have tested it properly, with a comment, then the other.

    Thank you

    Philippe

    Post edited by: Philip Keiter

  • huge problem with loading text fromXML

    Hi, I have spent hours trying to load text from XML, which is already responsible for thumbnails and FLV.
    I have a function that loads the xml file and then call for the FLV file from an onclick which requires the event.currentTarget.name
    Which works very well.
    Now I need to have a text in a text box, but I can only fill it with. currentTarget.name because all the other values are like... uh... lost?
    Here is the code:





    Acciones.transitions import. *;
    import of gs. TweenLite;
    import fl.motion.easing. *.
    var playeron = 0;


    var urlRequest:URLRequest = new URLRequest ("pics.xml");
    var urlLoader:URLLoader = new URLLoader();
    var xml;
    var xmlList:XMLList; urlLoader.load (urlRequest);
    urlLoader.addEventListener (Event.COMPLETE, urlLoaded);

    var arrayThumb:Array = new Array();
    var arrayName:Array = new Array();
    var arrayTitulo:Array = new Array();



    var photoContainer: Sprite = new Sprite();
    addChild (photoContainer);
    photoContainer.mask = thumb_holder;

    IT'S THE TEXT BOX WHERE THE TITLE SHOULD APPEAR
    var cartel: TextField = new TextField;
    cartel.x = 5;
    cartel.y = 5;
    cartel. Width = 110;
    cartel.autoSize = TextFieldAutoSize.LEFT;
    cartel. Selectable = false;
    addChild (cartel);

    var i: Number;
    function showXML(e:Event):void {}
    var imagenes:XML = new XML (e.target.data);
    }

    function urlLoaded(event:Event):void {}
    XML = XML (event.target.data);
    xmlList = xml.children ();
    trace (xmlList.length ());
    for (i = 0; i < xmlList.length (); i ++) {}
    thumb: thumbnail of the var = new Thumbnail (xmlList .url);
    var picName:String = xmlList
    .big_url;
    var titulo:String is xmlList .titulo;.
    var picTitle: String = String (xmlList
    .attribute ('name'));
    arrayName.push (picName);
    arrayThumb.push (thumb);
    arrayTitulo.push (picTitle);
    arrayThumb there = 67.5;
    arrayThumb
    .x = i * 186 + 90;
    arrayThumb .addEventListener (MouseEvent.CLICK, onClick);
    arrayThumb
    .name = arrayName ;

    photoContainer.addChild (thumb);




    It's the OnClick where I want to call the correspondent of TITLE I put in a table, a couple of lines before / / this. (arrayTitulo)
    I no longer get the entire table, an undefined value, or nothing. quite simply, it does not recognize what I'm doing. (who is clicking on this particular button)

    function onClick(event:MouseEvent):void {}

    cartel. Text = event.currentTarget.name;

    TweenLite.to (menutotal, 0.75, {x: 18, y:-139});})
    thumb_holder.x = - 1000;
    fondothumbs.x = - 1000;
    handler.x =-1000;
    Track.x =-1000;
    TweenLite.to(cerrarvideo,1,{x:611,y:60,alpha:1});)


    Fl.video import. *;

    TweenLite.to(cinepressplayer,1,{x:330,y:150});)
    CPL.source = event.currentTarget.name;
    Cpl.Play ();





    funcion close button
    cerrarvideo.addEventListener (MouseEvent.CLICK, onClick2);
    function onClick2(event:MouseEvent):void {}

    CPL.pause ();
    TweenLite.to(cerrarvideo,0.50,{x:-200,y:-200,alpha:0});)
    TweenLite.to(cpl,1,{x:-390,y:105});)
    TweenLite.to (menutotal, 0.75, {x: 18, y:56});})
    thumb_holder.x = 20;
    fondothumbs.x = 20;
    handler.x = 20;
    Track.x = 20;



    }





    }
    }

    -handles the Click event we added thumbnails.



    }


    var minScroll:Number = 0;
    var maxScroll:Number = track.width - handler.width;
    var shuffling: Boolean = false;
    limits: var = new Rectangle Rectangle(handler.x,handler.y,maxScroll,0);
    handler.buttonMode = true;
    handler.addEventListener (MouseEvent.MOUSE_DOWN, beginDrag);










    function beginDrag(event:MouseEvent):void {}
    handler.startDrag (false, bounds);
    dragging = true;
    handler.addEventListener (Event.ENTER_FRAME, checkingProgress);
    stage.addEventListener (MouseEvent.MOUSE_UP, endDrag);
    }
    function endDrag(event:MouseEvent):void {}
    handler.stopDrag ();
    dragging = false;
    }

    function checkingProgress(event:Event):void {}
    this var: number = handler.x/maxScroll.
    If (dragging) {}
    Tweener.addTween (photoContainer, {x: (-this *(photoContainer.width-thumb_holder.width)-6), duration: 1});
    }
    }

    This

    I forgot to mark it as resolved.

  • PS Elements 11 Organizer - importing a new Pic?

    If I import a pic in PS elements 11 Organizer, it creates a new picture file?  Doubling the space on my hard drive for this pic?

    No, it's just a link to your original hard disk. The thumbnails are simple previews.

  • Is anyone having problems with their 6 s new more not to send and receive images through text messages unless your cell data are lit?  Even if I'm on wifi, I won't get it the pic unless the cell data is on?

    Is a person with problems with their new 6s more iPhone send and receive pictures via SMS?  Even if I'm on WIFI, I have my cellular data button turned to receive a picture. Then in turn instead to use WIFI, it devours my data plan. If to halfway through the month I get warnings that my data plan has almost disappeared. I did everything, including resetting the phone to factory settings. It also does not send a text if IMessage is turned on. It switches immediately to Imessaging which of course, again use my data plan. Of course, I could use some help with this. BTW, my text messaging service is connected to my phone number and not my email. Who was one of the suggestions that support Apple told me to check. Never in my life have had so many problems with a phone since I bought this iphone 6 s.

    Mgibson2425 wrote:

    Is a person with problems with their new 6s more iPhone send and receive pictures via SMS?  Even if I'm on WIFI, I have my cellular data button turned to receive a picture. Then in turn instead to use WIFI, it devours my data plan. If to halfway through the month I get warnings that my data plan has almost disappeared. I did everything, including resetting the phone to factory settings. It also does not send a text if IMessage is turned on. It switches immediately to Imessaging which of course, again use my data plan. Of course, I could use some help with this. BTW, my text messaging service is connected to my phone number and not my email. Who was one of the suggestions that support Apple told me to check. Never in my life have had so many problems with a phone since I bought this iphone 6 s.

    SMS is a function of the carrier, you will need to contact your cell phone provider and see what is the matter.

    IMessage uses very little data.

  • When implementing my new iPhone, I logged into my old iCloud instead of choosing "set up as new iPhone" is there a way I can do this again? All my news from icloud is on my phone. All applications that I never downloaded and every pic ive taken. I don't w

    When implementing my new iPhone, I logged into my old iCloud instead of choosing "set up as new iPhone" is there a way I can do this again? All my news from iCloud is on my phone. All applications that I never downloaded all the photos I've ever taken since 2005 and I want to restart without remove ALL account iCloud himself. I always want to do a backup, I don't want it on my phone. I want to start fresh on my phone, but I tried to reset my phone under settings. I have just reset settings that did not 'you can't cancel it "because I don't want to lose all the photos I've ever taken." I always want to iCloud saving it just in case I need it someday, but I don't want any of this on my phone. I tried all means of security who do not say "you can't cancel" I still images and apps on my phone.

    Hello

    Turn off find my iPhone in settings then restore the iphone to factory settings.

    Now configure iphone as a new iPhone.

    See you soon

    Brian

Maybe you are looking for