Noob - DynamicStreaming / Simple Demo
Hello again,
I'm following Almer Blank's tutorial on Dynamic Streaming (located here: http://labs.almerblank.com/2010/04/new-intro-to-adobe-osmf-videos/)
His explanation is great but I think there might be a step missing (that or I'm lacking some prerequisite knowledge).
Below is my code thus far. When I run it I do get a runtime error of "null object reference" for "compareStreamItems" in "org\osmf\net\DynamicStreamingResource.as:175".
I'm having trouble pin-pointing where I'm at fault. My best guess is that something is funky with my vector setup. Anyone see any errors in the code I have implemented below?
<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
initialize="init()">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import org.osmf.containers.MediaContainer;
import org.osmf.elements.VideoElement;
import org.osmf.layout.LayoutMetadata;
import org.osmf.media.DefaultMediaFactory;
import org.osmf.media.MediaPlayer;
import org.osmf.net.DynamicStreamingItem;
import org.osmf.net.DynamicStreamingResource;
import org.osmf.net.rtmpstreaming.RTMPDynamicStreamingNetLoader;
private var mediaContainer:MediaContainer = new MediaContainer();
private var mediaFactory:DefaultMediaFactory = new DefaultMediaFactory();
private var videoElement:VideoElement;
private var mediaPlayer:MediaPlayer = new MediaPlayer();
private var mediaResource:DynamicStreamingResource = new DynamicStreamingResource("rtmp://10.248.56.67/jfoley/dynamic/");
private var vector:Vector.<DynamicStreamingItem> = new Vector.<DynamicStreamingItem> (6);
private function init():void
initMediaPlayer();
initDynamicStream();
private function initMediaPlayer():void
mediaPlayerContainer.addChild(mediaContainer);
private function initDynamicStream():void
vector[0] = new DynamicStreamingItem("mp4:BigBuckBunny_1330kbps", 1330000);
vector[1] = new DynamicStreamingItem("mp4:BigBuckBunny_1000kbps", 1000000);
vector[2] = new DynamicStreamingItem("mp4:BigBuckBunny_500kbps", 500000);
vector[3] = new DynamicStreamingItem("mp4:BigBuckBunny_280kbps", 280000);
mediaResource.streamItems = vector;
videoElement = new VideoElement(mediaResource);
mediaPlayer.media = videoElement;
mediaContainer.addMediaElement(videoElement);
]]>
</fx:Script>
<mx:UIComponent id="mediaPlayerContainer" />
</s:Group>
Doh! I figured this out 5 seconds after I posted it...
The problem is that I have referenced (6) items in my vector but only declared (4)... hence it is throwing an error at "compareStreamItems".
Solution: set my initial vector items to (4).
Similar Messages
-
J2ME dev tools for simple demo apps
Hello community,
I 've been using Java for a long time and recently got a project involving j2me. Its mostly apps for demo purposes, therefore there is not a lot of logic/network traffic involved. For example, one app is a bunch of screens guiding the user throught different text blobs and pictures. It is very similar in structure to browsable content, with links and forms, just like a very simple HTML site.
I have always used netbeans for developing java, and it seems that it has some neat tricks for create ME apps.You can use a nice drag and drop design mode that also auto-gens code. But I have found a tool like http://www.cascadamobile.com/ , in which you write simple HTML/js pages that link to each other and then this thing will generate the j2me code from that. That would be exactly what I would need for my purpose, save for the fact that the product is Ad-supported, so its a no-go.
Maybe I could make a j2me app as a WML-browsable content so that I would just have to compose the wml and then the app would just "browse" them from the phone's memory?
In any case, the question is, are there any fast tools for making simple (mostly demo) apps, in a j2me environment?
Thank you.RealBasic, Metrowerks Codewarrior, you might find some references on http://developer.apple.com/ and one software vendor I know still makes software for it is http://www.lemkesoft.com/
And they might be able to tell you what tools they use. -
Help noob with simple issue. Thanks!
Hey guys!
I am a first time flash-maker, and I sure how to get things to work as planned.
I have written the following code:
stop();
import flash.events.MouseEvent;
Weightlifting_btn.addEventListener(MouseEvent.CLICK, CursorClick);
function CursorClick(event:MouseEvent):void{
gotoAndStop("25");
But my problem is that i have a motion tween that startes at frame 5 and ends at frame 25. And the code says that at will go to and stop at frame 25.
what I really want it to do, is to go to frame 5, play the motion, and stop at frame 25.
How can I do this?
Thanks in advanceThat is AS3 code, so you should have posted in the AS3 forum. To make it start playing at frame 5, tell it to do that. If you want it to stop at frame 25, then place a stop() command at frame 25.
stop();
Weightlifting_btn.addEventListener(MouseEvent.CLICK, CursorClick);
function CursorClick(event:MouseEvent):void{
gotoAndPlay(5); // no quotes for frame numbers
(It looks like it's another one of those missing postings days... there were no responses showing here when I started here, but there should have been. And I'm noticing a good number of what has been posted today in the AS3 forum was missing when I last checked) -
Simple Serializable demo with problems
Hello!
I am having a very simple demo where I tried to see how the Serializable interface works. However, I am receiving message NotSerializableException. What's wrong?
Thanks in advance!
Kind regards,
Igor
Here's the demo:
import java.io.*;
public class SerializationDemo {
private class Data implements Serializable {
String someString = "This is a string";
double someDouble = 1;
public SerializationDemo() {
try {
FileOutputStream fos = new FileOutputStream("dataObjectSerialized");
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(new Data());
fos.close();
catch (Exception e) {
System.out.println(e.toString());
static public void main(String args[]) {
SerializationDemo demo = new SerializationDemo();
};Consider the following code. What do you expect Child.foo() to print? Why? Supposing you made it serializable, how would you expect it to behave when deserialized?
public class Illustration {
public Illustration(int x) {
this.x = x;
this.c = new Child();
public void foo() {
c.foo();
private Child c;
private int x;
private class Child {
public Child() {
public void foo() {
System.out.println(x);
public static void main(String[] argv) {
Illustration i = new Illustration(42);
i.foo();
}In case that's not clear, here's a quick illustration:
public class Illustration {
public class Child { ... }
+--------------+
| Illustration |
| |
| +-----+ |
| |Child| |
| +-----+ |
| |
+--------------+
public class Illustration {
public static class Child { ... }
+--------------+
| Illustration | +-----+
| |--->|Child|
| | +-----+
| |
| |
| |
+--------------+Because Child is not declared static, it has full access to all of the fields of Illustration. Therefore if you serialize it in order to work after deserialization as it did before, it must have copies of all of the owning class's fields.
When you declare it static you break this relationship and it becomes independent.
So taking your following question:
Why is this so? Does this mean that the following two statements would produce completely identical results, providing that SerializationDemo class was made Serializable:
oos.writeObject(new Data());
oos.writeObject(this);No, not quite - the first form creates a new Data object, serializes that, then (of necessity) serializes the owning class as well.
The second form just serializes the current class - since it doesn't have an associated Data object, nothing else gets serialized.
To achieve the effect you want, either make your Data class static, or declare it in its own file (which is roughly the same thing).
Dave. -
How to Implement simple Timer in this code
Hi there guys,
This is a small ftp client that i wrote. It has encryption and all bulit into it. I want to initiate the sendfile function every 5 minutes.
The program starts with the displaymenu function wherein a menu with various options is displayed.
How Do i Do that? I went online and tried doing it myself but cud not possibly think of a reason as to why my changes were not working.
Here is the basic code. I earnestly hope that some of you guys out there will help me. This is a very simple problem and sometimes it is the finer point that eludes us. any help will be deeply appreciated
import java.net.*;
import java.io.*;
import java.util.*;
import java.lang.*;
import javax.crypto.*;
import java.util.regex.*;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.PBEParameterSpec;
import java.security.spec.AlgorithmParameterSpec;
import java.security.spec.KeySpec;
class FTPClient
public static void main(String args[]) throws Exception
Socket soc=new Socket("127.0.0.1",5217);
transferfileClient t=new transferfileClient(soc);
t.displayMenu();
class transferfileClient
Socket ClientSoc;
DataInputStream din;
DataOutputStream dout;
BufferedReader br;
transferfileClient(Socket soc)
try
ClientSoc=soc;
din=new DataInputStream(ClientSoc.getInputStream());
dout=new DataOutputStream(ClientSoc.getOutputStream());
br=new BufferedReader(new InputStreamReader(System.in));
catch(Exception ex)
//encrypto routine starts
class DesEncrypter {
Cipher ecipher;
Cipher dcipher;
// 8-byte Salt
byte[] salt = {
(byte)0xA9, (byte)0x9B, (byte)0xC8, (byte)0x32,
(byte)0x56, (byte)0x35, (byte)0xE3, (byte)0x03
// Iteration count
int iterationCount = 19;
DesEncrypter(String passPhrase) {
try {
// Create the key
KeySpec keySpec = new PBEKeySpec(passPhrase.toCharArray(), salt, iterationCount);
SecretKey key = SecretKeyFactory.getInstance(
"PBEWithMD5AndDES").generateSecret(keySpec);
ecipher = Cipher.getInstance(key.getAlgorithm());
dcipher = Cipher.getInstance(key.getAlgorithm());
// Prepare the parameter to the ciphers
AlgorithmParameterSpec paramSpec = new PBEParameterSpec(salt, iterationCount);
// Create the ciphers
ecipher.init(Cipher.ENCRYPT_MODE, key, paramSpec);
dcipher.init(Cipher.DECRYPT_MODE, key, paramSpec);
} catch (java.security.InvalidAlgorithmParameterException e) {
} catch (java.security.spec.InvalidKeySpecException e) {
} catch (javax.crypto.NoSuchPaddingException e) {
} catch (java.security.NoSuchAlgorithmException e) {
} catch (java.security.InvalidKeyException e) {
// Buffer used to transport the bytes from one stream to another
byte[] buf = new byte[1024];
public void encrypt(InputStream in, OutputStream out) {
try {
// Bytes written to out will be encrypted
out = new CipherOutputStream(out, ecipher);
// Read in the cleartext bytes and write to out to encrypt
int numRead = 0;
while ((numRead = in.read(buf)) >= 0) {
out.write(buf, 0, numRead);
out.close();
} catch (java.io.IOException e) {
public void decrypt(InputStream in, OutputStream out) {
try {
// Bytes read from in will be decrypted
in = new CipherInputStream(in, dcipher);
// Read in the decrypted bytes and write the cleartext to out
int numRead = 0;
while ((numRead = in.read(buf)) >= 0) {
out.write(buf, 0, numRead);
out.close();
} catch (java.io.IOException e) {
} //encryptor routine ends
void SendFile() throws Exception
String directoryName; // Directory name entered by the user.
File directory; // File object referring to the directory.
String[] files; // Array of file names in the directory.
//TextIO.put("Enter a directory name: ");
//directoryName = TextIO.getln().trim();
directory = new File ( "E:\\FTP-encrypted\\FTPClient" ) ;
if (directory.isDirectory() == false) {
if (directory.exists() == false)
System.out.println("There is no such directory!");
else
System.out.println("That file is not a directory.");
else {
files = directory.list();
System.out.println("Files in directory \"" + directory + "\":");
for (int i = 0; i < files.length; i++)
String patternStr = "xml";
Pattern pattern = Pattern.compile(patternStr);
Matcher matcher = pattern.matcher(files);
boolean matchFound = matcher.find();
if (matchFound) {
dout.writeUTF("SEND");
System.out.println(" " + files[i]);
String filename;
filename=files[i];
File f=new File(filename);
dout.writeUTF(filename);
String msgFromServer=din.readUTF();
if(msgFromServer.compareTo("File Already Exists")==0)
String Option;
System.out.println("File Already Exists. Want to OverWrite (Y/N) ?");
Option=br.readLine();
if(Option=="Y")
dout.writeUTF("Y");
else
dout.writeUTF("N");
return;
System.out.println("Sending File ...");
// Generate a temporary key. In practice, you would save this key.
// See also e464 Encrypting with DES Using a Pass Phrase.
System.out.println("Secret key generated ...");
// Create encrypter/decrypter class
DesEncrypter encrypter = new DesEncrypter("My Pass Phrase!");
// Encrypt
FileInputStream fino=new FileInputStream(f);
System.out.println("Initialised ...");
encrypter.encrypt(fino,
new FileOutputStream("ciphertext.txt"));
System.out.println("generated ...");
fino.close();
FileInputStream fin=new FileInputStream("ciphertext.txt");
int ch;
do
ch=fin.read();
dout.writeUTF(String.valueOf(ch));
while(ch!=-1);
fin.close();
boolean success = (new File("ciphertext.txt")).delete();
if (success) {
System.out.println("temp file deleted .../n/n");
for (int j = 0; j < 999999999; j++){}
}//pattermatch loop ends here
else
{ System.out.println(" " + "Not an XML file-------->" +files[i]); }
}// for loop ends here for files in directory
}//else loop ends for directory files listing
System.out.println(din.readUTF());
}//sendfile ends here
void ReceiveFile() throws Exception
String fileName;
System.out.print("Enter File Name :");
fileName=br.readLine();
dout.writeUTF(fileName);
String msgFromServer=din.readUTF();
if(msgFromServer.compareTo("File Not Found")==0)
System.out.println("File not found on Server ...");
return;
else if(msgFromServer.compareTo("READY")==0)
System.out.println("Receiving File ...");
File f=new File(fileName);
if(f.exists())
String Option;
System.out.println("File Already Exists. Want to OverWrite (Y/N) ?");
Option=br.readLine();
if(Option=="N")
dout.flush();
return;
FileOutputStream fout=new FileOutputStream(f);
int ch;
String temp;
do
temp=din.readUTF();
ch=Integer.parseInt(temp);
if(ch!=-1)
fout.write(ch);
}while(ch!=-1);
fout.close();
System.out.println(din.readUTF());
public void displayMenu() throws Exception
while(true)
System.out.println("[ MENU ]");
System.out.println("1. Send File");
System.out.println("2. Receive File");
System.out.println("3. Exit");
System.out.print("\nEnter Choice :");
int choice;
choice=Integer.parseInt(br.readLine());
if(choice==1)
SendFile();
else if(choice==2)
dout.writeUTF("GET");
ReceiveFile();
else
dout.writeUTF("DISCONNECT");
System.exit(1);here is a simple demo of a Timer usage.
public class Scheduler{
private Timer timer = null;
private FTPClient client = null;
public static void main(String args[]){
new Scheduler(5000);
public Scheduler(int seconds) {
client = new FTPClient();
timer = new Timer();
timer.schedule(new fileTransferTask(), seconds*1000);
timer.scheduleAtFixedRate(new FileTransferTask(client), seconds, seconds);
public class FileTransferTask extends TimerTask{
private FTPClient client = null;
public FileTransferTask(FTPClient client){
this.client = client;
public void run(){
client.sendFile();
public class FTPClient{
public void sendFile(){
// code to send the file by FTP
}the timer will will schedule the "task": scheduleAtFixRate( TimerTask, long delay, long interval)
It basically spawn a thread (this thread is the class that you
implements TimerTask..which in this example is the FileTransferTask)
The thread will then sleep until the time specified and once it wake..it
will execute the code in the the run() method. This is why you want to
pass a reference of any class that this TimerTask will use (that's why
we pass the FTPClient reference..so we can invoke the object's
sendFile method). -
I am trying out the trial version of captivate 2 and have
created a simple demo and published it as an exe file. I'm trying
to launch the demo "exe" from a menu that I've built using
menubuilder. The problem is that instead of simply launching the
demo a prompt appears asking "Would you like to open the file or
save it to your computer". Is there a way to get around this and
simply open the demo up without this prompt? CheersHi Muzza 123 and welcome to our community
The fact you are seeing the prompt you are seems to suggest
you have taken that demo and placed it on a Web server.
Unfortunately, that's the standard (and desired) behavior for
anything served off a Web server in .EXE format. It's a security
thing. Think about it. You could be someone that desires to wreak
havoc on unsuspecting users. So you create a link to a .EXE file
that formats the user's hard drive. If there was nothing blocking
this action, really bad days would ensue.
Try publishing as .SWF and placing it on the server instead.
Additionally, use the "Export HTML" option, as the resulting HTML
page is designed to properly display your Captivate movie.
Cheers... Rick -
Please help with simple Classes understanding
Working further to understand Class formation, and basics.
At the Java Threads Tutorial site:
http://java.sun.com/docs/books/tutorial/essential/threads/timer.html
Goal:
1)To take the following code, and make it into 2 seperate files.
Reminder.java
RemindTask.java
2)Error Free
Here is the original, functioning code:
import java.util.Timer;
import java.util.TimerTask;
* Simple demo that uses java.util.Timer to schedule a task
* to execute once 5 seconds have passed.
* http://java.sun.com/docs/books/tutorial/essential/threads/timer.html
public class Reminder {
Timer timer;
public Reminder(int seconds) {
timer = new Timer();
timer.schedule(new RemindTask(), seconds*1000);
class RemindTask extends TimerTask {
public void run() {
System.out.println("Time's up!");
timer.cancel(); //Terminate the timer thread
public static void main(String args[]) {
new Reminder(5);
System.out.println("Task scheduled.");
}Here is what I tried to 2 so far, seperate into 2 seperate files:
Reminder.java
package threadspack; //added this
import java.util.Timer;
import java.util.TimerTask;
* Simple demo that uses java.util.Timer to schedule a task
* to execute once 5 seconds have passed.
* http://java.sun.com/docs/books/tutorial/essential/threads/timer.html
public class Reminder {
Timer timer;
public Reminder(int seconds) {
timer = new Timer();
timer.schedule(new RemindTask(), seconds*1000);
public static void main(String args[]) {
new Reminder(5);
System.out.println("Task scheduled.");
}and into
RemindTask.java
package threadspack; //added this
import java.util.Timer;
import java.util.TimerTask;
import threadspack.Reminder; //added this
* http://java.sun.com/docs/books/tutorial/essential/threads/timer.html
public class RemindTask extends TimerTask
Timer timer; /**here, I added this, because got a
"cannot resolve symbol" error if try to compile w/out it
but I thought using packages would have negated the need to do this....?*/
public void run() {
System.out.println("Time's up!");
timer.cancel(); //Terminate the timer thread
}After executing Reminder, the program does perform, even does the timing, however, a NullPointerException error is thrown in the RemindTask class because of this line:
timer.cancel(); //Terminate the timer thread
I am not sure of:
If I have packages/import statements setup correctly
If I have the "Timer" variable setup incorrectly/wrong spot.
...how to fix the problem(s)
Thank you!Hi there!
I understand that somehow the original "Timer" must
be referenced.
This is a major point of confusion for me....I
thought that when importing
Classes from the same package/other packages, you
would have directly
access to the variables within the imported Classes.I think you have one of the basic points of confussion. You are mixing up the concept of a "Class" with the concept of an "Object".
Now, first of all, you do not need packages at all for what you are trying to do, so my advice is you completely forget about packages for the moment, they will only mess you up more. Simply place both .class files (compiled .java files) in the same directory. Your program is executing fine, so that indicates that the directory in which you have your main class file is being included in your classpath, so the JVM will find any class file you place there.
As for Classes/Objects, think of the Class as the map in which the structure of a building is designed, and think of the Object as the building itself. Using the same technical map the architect defines, you could build as many buildings as you wanted. They could each have different colors, different types of doors, different window decorations, etc... but they would all have the same basic structure: the one defined in the technical map. So, the technical map is the Class, and each of the buildings is an object. In Java terminology, you would say that each of the buildings is an "Instance" of the Class.
Lets take a simpler example with a class representing icecreams. Imagine you code the following class:
public class Icecream{
String flavor;
boolean hasChocoChips;
}Ok, with this code, what you're doing is defining the "structure" of an icecream. You can see that we have two variables in our class: a String variable with the description of the icecream's flavor, and a boolean variable indicating whether or not the icecream has chocolate chips. However, with that code you are not actually CREATING those variables (that is, allocating memory space for that data). All you are doing is saying that EACH icecream which is created will have those two variables. As I mentioned before, in Java terminology, creating an icecream would be instantiating an Icrecream object from the Icecream class.
Ok, so lets make icrecream!!!
Ummm... Why would we want to make several icecreams? Well, lets assume we have an icecream store:
public class IcecreamStore{
}Now, we want to sell icecreams, so lets put icecreams in our icecream store:
public class IcecreamStore{
Icecream strawberryIcecream = new Icecream(); //This is an object, it's an instance of Class Icecream
Icecream lemonIcecream = new Icecream(); //This is another object, it's an instance of Class Icecream
}By creating the two Icecream objects you have actually created (allocated memory space) the String and boolean variable for EACH of those icecreams. So you have actually created two String variables and two boolean variables.
And how do we reference variables, objects, etc...?
Well, we're selling icecreams, so lets create an icecream salesman:
public class IcecreamSalesMan{
}Our icecream salesman wants to sell icecreams, so lets give him a store. Lets say that each icecream store can only hold 3 icecreams. We could then define the IcecreamStore class as follows:
public class IcecreamStore{
Icecream icecream1;
Icecream icecream2;
Icecream icecream3;
}Now lets modify our IcecreamSalesMan class to give the guy an icecream store:
public class IcecreamSalesMan{
IcecreamStore store = new IcecreamStore();
}Ok, so now we have within our IcecreamSalesMan class a variable, called "store" which is itself an object (an instance) of the calss IcecreamStore.
Now, as defined above, our IcecreamStore class will have three Icecream objects. Indirectly, our icecream salesman has now three icecreams, since he has an IcecreamStore object which in turn holds three Icecream objects.
On the other hand, our good old salesman wants the three icecreams in his store to be chocolate, strawberry, and orange flavored. And he wants the two first icecreams to have chocolate chips, but not the third one. Well, here's the whole thing in java language:
public class Icecream{ //define the Icecream class
String flavor;
boolean hasChocoChips;
public class IcecreamStore{ //define the IcecreamStore class
//Each icecream store will have three icecreams
Icecream icecream1 = new Icecream(); //Create an Icecream object
Icecream icecream2 = new Icecream(); //Create another Icecream object
Icecream icecream3 = new Icecream(); //Create another Icecream object
public class IcecreamSalesMan{ //this is our main (executable) class
IcecreamStore store; //Our class has a variable which is an IcecreamStore object
public void main(String args[]){
store = new IcecreamStore(); //Create the store object (which itself will have 3 Icecream objects)
/*Put the flavors and chocolate chips:*/
store.icecream1.flavor = "Chocolate"; //Variable "flavor" of variable "icecream1" of variable "store"
store.icecream2.flavor = "Strawberry"; //Variable "flavor" of variable "icecream2" of variable "store"
store.icecream3.flavor = "Orange";
store.icecream1.hasChocoChips = true;
store.icecream2.hasChocoChips = true;
store.icecream3.hasChocoChips = false;
}And, retaking your original question, each of these three classes (Icecream, IcecreamStore, and IcecreamSalesMan) could be in a different .java file, and the program would work just fine. No need for packages!
I'm sorry if you already knew all this and I just gave you a stupid lecture, but from your post I got the impression that you didn't have these concepts very clear. Otherwise, if you got the point, I'll let your extrapolate it to your own code. Should be a pice of cake! -
Hello everybody!
I need a little help about an animation using Lingo!
I need to make 8 sprites and make them look as a volume controler and then make two bottons ( " - " and " + ") and make it looks like that those two bottons controle the volume by pressing " + " , sprite(1) should appear and then when I press it again sprite(2) should appear and so on till sprite(8); and the same thing for the " - " botton, when pressed, sprite(8) should disappear and when pressed again sprite(7) should disappear and so on...
Any help will be appreciated!
Thank you in advance!There is certainly nothing at all wrong with the suggestion supplied by pallottadesign, but I thought I might provide an alternative solution. I think I understand how you want this volume control to look, but I may be wrong. One of my favorite techniques is to use imaging lingo to create a "one-sprite widget".
With this behavior you need only one bitmap member as a sprite on the stage. However you do need an additional 3 bitmap cast members in the cast (but not on the score). You need an + button, - button and a "volume indicator" (like a rectangle) that will be repeated depending on the current volume. These 3 cast members should all be the same height.
Attach this behavior to a bitmap sprite. It doesnt matter what the bitmap looks like because the script alters the image. There are parameters that will need to be modified, so open the behaviors parameter dialog to do that. I have a simple demo movie I can send you, so send me a private message with your email address if you want it.
-- VOLUME CONTROL ONE SPRITE WIDGET --
property spriteNum, pMe, pNumLevels, pDownButton, pUpButton, pVolumeIndicator, pSpacing, pBitDepth, pCurrentVolume, pStartingVolume
on beginSprite me
pMe = sprite(spriteNum)
pCurrentVolume = pStartingVolume
updateImage(me)
end
on mouseUp me
if the clickLoc[1] - pMe.loc[1] < pDownButton.width then
if pCurrentVolume > 0 then
pCurrentVolume = pCurrentVolume - 1
-- Your code here
updateImage(me)
end if
else if the clickLoc[1] - pMe.loc[1] > pMe.width - pUpButton.width then
if pCurrentVolume < pNumLevels then
pCurrentVolume = pCurrentVolume + 1
-- Your code here
updateImage(me)
end if
end if
end
on getPropertyDescriptionList
description = [:]
addProp description,#pNumLevels, [#default:1, #format:#integer, #comment:"Number of volume levels"]
addProp description,#pDownButton, [#default:member(0), #format:#member, #comment:"Volume down button cast member"]
addProp description,#pUpButton, [#default:member(0), #format:#member, #comment:"Volume up button cast member"]
addProp description,#pVolumeIndicator, [#default:member(0), #format:#member, #comment:"Volume indicator cast member"]
addProp description,#pBitDepth, [#default:24, #format:#integer, #comment:"Bit Depth"]
addProp description,#pSpacing, [#default:1, #format:#integer, #comment:"Spacing"]
addProp description,#pStartingVolume, [#default:0, #format:#integer, #comment:"Starting volume"]
return description
end
on updateImage me
imageWidth = pDownButton.width + pUpButton.width + (pNumLevels * pVolumeIndicator.width) + ((pNumLevels + 1) * pSpacing)
imageHeight = pVolumeIndicator.height
newImage = image(imageWidth, imageHeight, pBitDepth)
newImage.copyPixels(pDownButton.member.image, pDownButton.rect, pDownButton.rect)
repeat with counter = 1 to pNumLevels
if counter <= pCurrentVolume then
x1 = pDownButton.width + (counter * pSpacing) + ((counter - 1) * pVolumeIndicator.width)
y1 = 0
x2 = x1 + pVolumeIndicator.width
y2 = pVolumeIndicator.height
newImage.copyPixels(pVolumeIndicator.member.image, rect(x1,y1,x2,y2) , pVolumeIndicator.rect)
end if
end repeat
newImage.copyPixels(pUpButton.member.image, rect(newImage.width - pUpButton.width, 0, newImage.width, newImage.height), pUpButton.rect)
pMe.member.image = newImage
pMe.width = pMe.member.width
pMe.height = pMe.member.height
pMe.member.regPoint = point(0,0)
end -
Hello All,
I'm wanting to do a Mobile IP demo for university and I have the following simple demo in mind -
I would have 2 routers connected via a serial cable, with a LAN on each side. I'd have a Wireless Access Point on each LAN and set them so there's an overlap. I would like 2 devices in my hands, one configured for Mobile IP and one that isn't. I would put a video file on a server and start streaming it on both devices. When I walk between the Access Points the Mobile IP device should continue to stream whilst the non Mobile IP stops.
The problem I am having is finding the client software for the mobile to enable mobile IP. On the Cisco website they mention SaveMove by Birdstep but it appears to be enterprise software.
Does anyone know where I could find a free/cheap Mobile IP client that would be compatible with Cisco routers?
Kind Regards,
RJSmith92I'm not sure to know about mobile IP on wired devices, but maybe this can help ?
http://www.cisco.com/en/US/partner/docs/solutions/Enterprise/Mobility/emob41dg/ch12MoIP.html
Nicolas -
could someone please mail me a simple demo (fmb) which uses webutil?
it just needs a button on it which opens the file-browse-window. for example.
thanks a lot!
[email protected]There is a C_API demo but we are working on a demo which covers all the functions of webutil...
Watch this space.
Regards
Grant Ronald
Forms Product Management -
Simple games run very slowly on iPad
I gave the iPhone packager a spin last night and tested it using the demos off of Flixel, a popular bitmap game engine to benchmark performance. Although I was happy that I could get these demos running on my iPad rather quickly, the performance of the games was disappointing, averaging around 10 FPS, which is well below playable. These are very simple demos that run at 60 FPS on any desktop.
This is one such example.
http://flixel.org/flxinvaders/
Am I expecting too much from the packager, or is this cause for concern?I would not say that the devguide is memorized by me yet, but I have read it and I get the gist. I did overlook the portion discussing vector drawn objects being slower and removing nested children to make them siblings (though that nesting seems a bit of a limitation and might require a number of design pattern hoops to jump through to implement that well in a large game). I understand cacheAsBitmap and use it when needed - but lack of scaling and rotation (which is what I first animated if you reread above) invalidates cacheAsBitmap anyway and is a huge limitation.
I wasn't stating anything as fact or proof anywhere in ANY of my posts. I came to this forum as someone open to learning, but also to see other developers experiences. There is very little on the web as of today that discusses the ins and outs of the limitations or constraints of the translation of SWF to IPA by the Packager. I have yet to see any app created in this fashion that does animate smoothly so that along with as I said very initial and preliminary tests have disappointed me.
I mentioned my experience as a developer for no other reason that to indicate that I am an AS3 person who loves Flash and wants to set the tone so it didn't appear that I'm coming in here trolling or bashing flash. The fact is I have done alot of high end AS3 work in Flash and Flex and totally dig it as a platform - I want Flash apps to work well on iOS.
Apparently I was naive to think my AS3 knowledge was enough to create simplistic but smooth animations quickly with the translation. Clearly something is going on with the approach the Packager takes and that introduces constraints in the way the drawing is handled which results in poor frame rates without GPU (if that is indeed what is happening in my initial test).
I'm happy to reread that section in the pdf and scour it for optimization techniques of sibiling children etc and do that. Clearly I missed some of that and was hoping to get some pointers here from the horse's mouth so to speak of developers who DO have it working.
It's easy to say "you're no advanced coder" and sit back and say "I've done it you suck- how dare you besmirch Flash". But believe me mr12Fingers I am not claiming something can't be done. I am saying I could not achieve decent animation quickly and have not seen one single animation in ANY iPhone or iPad Packager app that is as smooth as a typical high framerate 2D game written in xcode Obj C.
Saying I'm blindly conducting tests is innaccurate. I hardly said I've exhaustively benchmarked the Flash Packager's performance. I said it was my first time "taking it for a spin" and it was a hello world app and that I had problems with the results and haven't seen anything to tell me different. It's kind of blind in my opinion to have blinders on to anyone who doesn't have the same experience as you.
Please take the time to help or assist or point me in the direction of achieving that, or confirm my very preliminary but disheartening results which my hello world type apps and what is actually out there seem to indicate to me. Or if you can't do any of that then please don't muddy the conversation with being adversarial. I don't intend to be and would love to hear what you or anyone who has a different experience than my initial ones with the Packager.
thank you for telling me that you had no trouble with your cert. Can you please elaborate on what steps you took to use the same Mac cert from the keychain and use it in a windows 7 bootcamp with the packager. Whenever I tried that the Packager would fail with "invalid certificate" (though that cert works in Xcode on the mac) and the only way I could get the Packager to work was to regenerate the cert on Windows using the OpenSSL method after revoking the original one.
Clearly I am new to the DRM methods of iOS development, but the steps in the pdf didn't fully work for me.
Thanks for any assistance, and please let's make this conversation a bit more helpful for each other rather than adversarial. -
New developer with spacial - need simple example
Dear All
i developing an application that need to store coordinates which represented with 3 floats. i need simple demo which illustrates me how can i insert such coordinate using Oracle Spatial and the how to select it. i also need little explanation of the structure of the select and insert queries
Thanks alotWell, Ron, I think you will need to read a minimum in order to use oracle spatial. I admit that the Oracle docset can seem daunting, but I don't think you can use it without at least reading some of the Oracle Spatial Users Guide, available here (file://localhost/D:/Doc/Oracle/1020/B19306_01/appdev.102/b14255/toc.htm) in HTML and PDF.
I suggest reading at least chapters 1 (concepts) and 2 (data types) in this manual.
Albert -
What's wrong about those layouts??
Well, I've been working like crazy to be able to do something with layouts... Let me explain how our program is made...
Main window:
- JContentPane
- JSplitPane with two parts
in each, i have
5 JPanels with information in it
I'm working with Eclipse and its visual editor, but can't seem to figure out a way to do this... In my west panel, I have to put four buttons. I want them to be a certain size and in a certain order. Here is the code generated by the editor:
private JPanel getJPanel_west() {
if (jPanel_west == null) {
GridLayout gridLayout = new GridLayout();
jPanel_west = new JPanel();
jPanel_west.setLayout(gridLayout);
gridLayout.setRows(4);
gridLayout.setColumns(1);
jPanel_west.add(getJButton(), null);
jPanel_west.add(getJButton1(), null);
jPanel_west.add(getJButton2(), null);
jPanel_west.add(getjButtonImprimer(), null);
return jPanel_west;
Not very fun to work with... Now, what it does is that when i resize my JSplitPane, the button sizes change, proportionnally to the size changed... How can I get all this straight! I want my four buttons in the same size and I don't want them to resize all the time...
Anybody could help me with this??
Thanks
Guillaumemaybe you can change the layout to a BoxLayout, which honors MaximumSize()
here's a simple demo
import java.awt.*;
import javax.swing.*;
import java.util.*;
class Testing extends JFrame
public Testing()
setLocation(400,300);
setDefaultCloseOperation(EXIT_ON_CLOSE);
//JPanel westPanel = new JPanel();
//westPanel.setLayout(new BoxLayout(westPanel,BoxLayout.Y_AXIS));
JPanel westPanel = new JPanel(new GridLayout(4,1));//comment out this, uncomment above 2 lines
JButton btn1 = new JButton("1");
btn1.setMaximumSize(new Dimension(100,30));
westPanel.add(btn1);
JButton btn2 = new JButton("2");
btn2.setMaximumSize(new Dimension(100,30));
westPanel.add(btn2);
JButton btn3 = new JButton("3");
btn3.setMaximumSize(new Dimension(100,30));
westPanel.add(btn3);
JButton btn4 = new JButton("4");
btn4.setMaximumSize(new Dimension(100,30));
westPanel.add(btn4);
getContentPane().add(westPanel);
pack();
public static void main(String[] args){new Testing().setVisible(true);}
} -
How do i control an external movie in a separate browser window?
i am creating a website for a band, with an mp3 player. i
want to be able to make an mp3 player that pops up in a separate
browser window. the mp3 player would have a "playlist" that can be
dynamically changed from the main window, which gives a list of
albums & tracks to choose from. the model for this is
Rhapsody's web interface.
so, how would i go about creating & dynamically changing
the playlist (while music is playing) across multiple browser
windows? the "playlist" would be an array of references to mp3s, i
guess-- so is there a way to pass events & variables across the
windows?This URL has simple demo on LocalConnection.
http://actionscriptandflex.blogspot.com/2010/09/localconnection-example-in-actionscript.ht ml -
How to get parameter value from report in event of value-request?
Hi everyone,
The customer want to use particular F4 help on report, but some input value before press enter key are not used in event of "at selection-screen on value-request for xxx", How to get parameter value in this event?
many thanks!
JackYou probably want to look at function module DYNP_VALUES_READ to allow you to read the values of the other screen fields during the F4 event... below is a simple demo of this - when you press F4 the value from the p_field is read and returned in the p_desc field.
Jonathan
report zlocal_jc_sdn_f4_value_read.
parameters:
p_field(10) type c obligatory, "field with F4
p_desc(40) type c lower case.
at selection-screen output.
perform lock_p_desc_field.
at selection-screen on value-request for p_field.
perform f4_field.
*& Form f4_field
form f4_field.
*" Quick demo custom pick list...
data:
l_desc like p_desc,
l_dyname like d020s-prog,
l_dynumb like d020s-dnum,
ls_dynpfields like dynpread,
lt_dynpfields like dynpread occurs 10.
l_dynumb = sy-dynnr.
l_dyname = sy-repid.
*" Read screen value of P_FIELD
ls_dynpfields-fieldname = 'P_FIELD'.
append ls_dynpfields to lt_dynpfields.
call function 'DYNP_VALUES_READ'
exporting
dyname = l_dyname
dynumb = l_dynumb
tables
dynpfields = lt_dynpfields
exceptions
others = 1.
check sy-subrc is initial.
*" See what user typed in P_FIELD:
read table lt_dynpfields into ls_dynpfields
with key fieldname = 'P_FIELD'.
*" normally you would then build your own search list
*" based on value of P_FIELD and call F4IF_INT_TABLE_VALUE_REQUEST
*" but this is just a demo of writing back to the screen...
*" so just put the value from p_field into P_DESC plus some text...
concatenate 'This is a description for' ls_dynpfields-fieldvalue
into l_desc separated by space.
*" Pop a variable value back into screen
clear: ls_dynpfields.
ls_dynpfields-fieldname = 'P_DESC'.
ls_dynpfields-fieldvalue = l_desc.
append ls_dynpfields to lt_dynpfields.
call function 'DYNP_VALUES_UPDATE'
exporting
dyname = l_dyname
dynumb = l_dynumb
tables
dynpfields = lt_dynpfields
exceptions
others = 0.
endform. "f4_field
*& Form lock_p_desc_field
form lock_p_desc_field.
*" Make P_DESC into a display field
loop at screen.
if screen-name = 'P_DESC'.
screen-input = '0'.
modify screen.
exit.
endif.
endloop.
endform. "lock_p_desc_field
Maybe you are looking for
-
Web Service consumer using ABAP-PROXY
Hello, I want to test Web Service consumer using ABAP-PROXY . So I do what is explain in the weblog : [http://wiki.sdn.sap.com/wiki/display/Snippets/WebServiceconsumerusingABAP-PROXY] But when I execute the programm, the message : 'No valid source co
-
SAP - Cost Center Planning - Version 1
Dear All Recently we have started to use the cost center planning through KP16 under plan version -1 However we are unable to down the plan data in excel with a cost center break up through KSBP report. We are not using any special ledger System is s
-
HTTP Server does not start -- 9ias 1.0.2.2.0
HTTP Server does not start -- 9ias 1.0.2.2.0 Installed 9iAS Enterprise Edition. Whole installation went well. Finally when I reboot the machine, the HTTP Service does not start. When I try to start the service it gives "Could not start OracleiSuitesH
-
Hello, We are unable to add a new system in the ACC.Initially we addeed one system in the ACC and everything went fine but we are facing trouble while another system in the ACC.We are getting the following error " Hostname'loopback' is reported from
-
I can use my facetime on certain people but on my other friends, it just saying "(my friends name) is not available" I even tried some of troubleshoot that the apple support gave to me but still no luck, I even updating my iPad to iOS Bugs a.k.a iOS