Welcome to the RareWire Community Board. Use the field below to add your own contribution or find answers in existing topics. 
+1
Answered

Trouble with classes

Lcdrgreg 11 years ago updated 11 years ago 2
+1
Answered

Is there a way to run a < play> command after an alert box has been dismissed?

thillsman 12 years ago updated 12 years ago 2
I'm working on a Tic Tac Toe app where an alert box tells who wins after a winning play has been made. I would like the alert box to pop up after the winning play (it does currently) and then clear the Xs and Os off the game board when a user dismisses the prompt. Here's what I have:

< if lhs="[var:cur1]" operator="e" rhs="[var:cur2]">
< if lhs="[var:cur1]" operator="e" rhs="[var:cur3]">
< alert title="You win!" message="[var:cur1] is the winner!" />
< play action="resetit" />
< /if>
< /if>

The "resetit" action runs concurrently with the alert. I've tried putting < sync> around the alert and play actions, but it works exactly the same. I know you can delay the sync, but delaying it for a set amount of time wouldn't be a very good user experience. Any tips?
+1
Answered

Is there a good way to combine < if> operations with AND or OR?

thillsman 12 years ago updated 12 years ago 2
I'm working on a Tic Tac Toe app. It's functional, but the code's long. To determine whether the game has been won, I use < if> tags to compare variables like this:

< if lhs="[var:cur1]" operator="e" rhs="[var:cur2]">
< if lhs="[var:cur1]" operator="e" rhs="[var:cur3]">
< alert title="You win!" message="[var:cur1] is the winner!" />
< /if>
< /if>

where the variable are the status of the top three boxes on the tic tac toe board (X or O). Is there a cleaner way to say "if cur1, cur2, and cur 3 are equal, prompt alert"?

Thanks!

PS: Is there a good way to share script on the forums?
+1
Answered

Local XML file and datasources - error

sstava 12 years ago updated by icahill (Administrator) 12 years ago 1
I am trying to do something simple...so I thought. In reality, I may be simple and that could be the problem :) so any help would be greatly appreciated!

My goal was to have a local XML file and display the contents in my app. I was basing the code off of the rssfeed example in the intro to data sources tutorial. The rssfeed app works fine for me...Yay!

So, back to my original goal...displaying the content of an app-local XML file.
When I use a data source to load the XML file, I get a data source error. That is obviously what prevents me from showing the data, but I can't figure out what is causing the error or what the specific error is.

I have copied an rss feed's XML content into my local xml file to make sure the XML file is valid. In my example app, I have two data sources.

One is the Internet-based rss feed...it works.

The other is the same rss content, but copied into an app-local XML file...it fails.

My example app:




<wire>
<datasources>
<datasource name="economistrss" source="http://www.economist.com/rss/the_world_this_week_rss.xml" providertype="xml" query="//item" />
<datasource name="economistxml" source="economist.xml" providertype="xml" query="//item" />
</datasources>

<styles>
</styles>

<classes>
</classes>

<main>
<panel name="canvas" alias="CANVAS" width="100%" height="100%" background="#cc0000">
<text name="info" alias="INFO" text="Before Change" font="helvetica" size="30" color="#cc0000" width="100%" height="25%" alignment="center" align="center" valign="center" background="#ffffff" onclickup="show-rss" onswipedown="show-xml"/>
</panel>
</main>

<actions>
<action name="show-rss" >
<assign property="object:INFO.text" value="[datasource:economistrss.dataSourceResultCount]" />
</action>
<action name="show-xml" >
<assign property="object:INFO.text" value="[datasource:economistxml.dataSourceResultCount]" />
</action>
<action name="error-rss" datasource="economistrss" datasourceevent="datasourceerror">
<assign property="object:INFO.text" value="Economist RSS: datasource error" />
</action>
<action name="error-xml" datasource="economistxml" datasourceevent="datasourceerror">
<assign property="object:INFO.text" value="Economist XML: datasource error" />
</action>
</actions>
</wire>



XML file content:




<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
<channel>
<title>The Economist: The world this week</title>
<description>The world this week</description>
<link>http://www.economist.com</link>
<image>
<link>http://www.economist.com</link>
<width>125</width>
<title>Economist.com</title>
<url>//media.economist.com/sites/all/themes/econfinal/images/the-economist-logo.gif</url>
<height>34</height>
</image>
<language>en-gb</language>
<lastBuildDate>Thu, 16 August 2012 15:04:05 GMT</lastBuildDate>
<webMaster>webmaster@economist.com</webMaster>
<managingEditor>rondiorio@economist.com</managingEditor>
<ttl>120</ttl>
<docs>http://www.economist.com/rss/</docs>
<item>
<title>Business this week</title>
<link>http://www.economist.com/node/21560609?fsrc=rss|twt</link>
<guid>http://www.economist.com/node/21560609</guid>
<pubDate>Thu, 16 August 2012 15:04:05 GMT</pubDate>
</item>
<item>
<title>Politics this week</title>
<link>http://www.economist.com/node/21560613?fsrc=rss|twt</link>
<guid>http://www.economist.com/node/21560613</guid>
<pubDate>Thu, 16 August 2012 15:04:05 GMT</pubDate>
</item>
<item>
<title>KAL&#039;s cartoon</title>
<link>http://www.economist.com/node/21560619?fsrc=rss|twt</link>
<guid>http://www.economist.com/node/21560619</guid>
<pubDate>Thu, 16 August 2012 15:04:05 GMT</pubDate>
</item>
</channel>
</rss>

+1
Answered

Is it possible to move an app from one portfolio to another?

storycode 12 years ago updated by icahill (Administrator) 12 years ago 1
+1
Completed

Text Expander Library

icahill (Administrator) 12 years ago updated 11 years ago 6
If anyone is using TextExpander, here is a link to a WIRE library you can install and use. This is a great way to use autocomplete in the online Editor or translate into other text editors.

http://studio.rarewire.com/wordpress/...
+1
Completed

New Magazine Newsstand Sample App

icahill (Administrator) 12 years ago updated 12 years ago 1
Head on over to our Tutorials Page and check out the Sample Apps section. If you download the zip file and upload the content to a new App in the studio, you will be able to check out a working sample!

Our latest is a real working Magazine App based on an existing App in the itunes store.

Check it out: Tutorials
+1
Answered

Are there more invitation codes that I can share?

aaron 12 years ago updated by icahill (Administrator) 12 years ago 4
I've got friends who weren't on the email list that would like invitations. Can I get more invite codes?
+1
Answered

Loop a sound file.

doug 12 years ago updated by ajakhua 11 years ago 6
This might be a feature request, maybe not. I am trying to loop a sound action using the "sync" tag, but no dice. Is there a work around?
+1
Answered

The PDF file cannot be found in Ad Hoc build

mgruberdesign 12 years ago updated by icahill (Administrator) 12 years ago 5
When I create an Ad-Hoc build, the PDF file is not loading, and I get an error message as follows:

Error
The file 'GlobalThinkTanks2011.pdf' cannot be found.

Why would the PDF not be included in the build?

Do I have to tell it to include the PDF?
+1
Answered

Question on datasource webinar

steve 12 years ago updated by icahill (Administrator) 12 years ago 3
I was watching the datasource webinar and have a couple of questions on how I need to change the queries in order to reflect a slightly different feed structure.

In the webinar, the global post image nodes are structured like this http://imageurl.jpg. However, the feed that I'm working has a url= in front of the image url and it looks more like this . My question is how to alter the query. Does it need to look more like the image query in the "intro to datasources tutorial"

Also, in my feed some of the posts have several images. The are all tagged like
image title. Is there a way to call these images using some sort index parameter the way you can call feed items?

Please let me know if these questions are unclear.
+1
Thanks

Tutorials

jenifercmartin 12 years ago 0
Great tutorials. I am a complete novice and am building (simple) apps after an afternoon of watching and reading tutorials. You made it very simple to understand and begin!
+1
Answered

pager reset

paololuk 12 years ago updated 12 years ago 10
I'm using the pager tutorial in my app. A question: how to hide the pager at the start showing only the upbutton? Because the app start with the pager navigation in the "up" state and the upbutton on the bottom (?). A snippet will be nice :)
+1
Answered

Application Loader - Icon-Small-50.png doesnt meet the size requirements 72x72

mgruberdesign 12 years ago updated by icahill (Administrator) 12 years ago 4
I have published the app and downloaded the .ipa file. When I go to send it to apple via the Application Loader, I get an error message:

"iPad: Icon-Small-50.png: icon dimensions (50x50) don't meet the size requirements. The icon file must be 72x72 pixels, in .png format"

The issue I am having is that not all of the icon previews are showing up under the settings screen before I publish. I checked, and my files are all set to the proper dimensions.
+1
Under review

Make 'play' have the option to be synchronous.

storycode 12 years ago updated by icahill (Administrator) 12 years ago 5
Calling 'play' causes the called action to execute asynchronously - i.e. the action that contains the play will carry on executing without waiting for the called action to complete.
This is a problem if you are creating a series of objects in a loop in response to a user action. You have no way of knowing when the loop completes.
So if the user action causes the current series of objects to be deleted and new ones created, and it is not possible to tell when the action has completed creating the new objects, the user could trigger the action again before it has completed - causing the objects to be deleted before they have finished being created - which causes the app to crash...

It would be really nice if the 'play' action had a flag to make it synchronous so that it could be used as a way of calling actions in the same way that developer created functions are used in any other language - i.e. reusable chunks of code which may change some global variable or passed in parameter and the calling function/action could then act on the modified variables.
+1
Answered

Timed Actions

dbdesign 12 years ago updated by ajones 12 years ago 6
I am trying to make an animation to play at the launch of the app. I have two images (launchiphone-00000.png and launchiphone-00001.png) that I want to play using an "imagestrip." I have the "imagestrip" and the "playstrip" in place. I want the action to play the animation for 5 seconds.

So I have two problems:
1. My imagestrip images are not showing.
2. How do I make the action run for 5sec before fading to alpha="0"?


<panel name="launchcontainer" alias="LAUNCHCONTAINER" height="100%" width="100%" xpos="0" ypos="0" background="#a58d3c" alpha="1">
<platform device="iPhone"><imagestrip name="launchgraphic" alias="LAUNCHGRAPHIC" prefix="images/launchiphone-" fps="25"></imagestrip></platform>
<platform device="iPad"><imagestrip name="launchgraphic" alias="LAUNCHGRAPHIC" prefix="images/launchipad-" fps="25"></imagestrip></platform>
</panel>

<action name="launchgraphic" oninit="yes">
<playstrip target="LAUNCHGRAPHIC" loops="yes" time="5"/>
</action>
Answer
ajones 12 years ago
While image strip is a method provided within iOS to allow for burst of animated content, the conversion within iOS from image to sequenced video can be a little cumbersome and does not carry the best performance effort within iOS.

One trick I like to use within Wire when I need to animatie a sequence of images is a combination of load, conditional statements and an action that loops over itself to give me optimal control of my sequence.

First the finish action blocks of code we'll be using:



<main>
<image name="AnimatedSeq" alias="ANIMATED-SEQ" />
</main>

<action oninit="yes">
<assign property="var:frameCount" value="0" />
</action>

<action name="loop">
<if lhs="[var:frameCount]" operator="lte" rhs="26">
<sync delay="0">
<load source="graphics/mySeq[var:frameCount].jpg" target="ANIMATED-SEQ"/>
<assign property="var:frameCount" value="[eval: [var:frameCount] + 1]" />
<if lhs="[var:frameCount]" operator="lt" rhs="26">
<play action="loop"/>
</if>
<if lhs="[var:frameCount]" operator="=" rhs="26">
<alert message="I'm Done" />
</if>
</sync>
</if>
</action>


First let's look at the image we will be replacing in the sequence.


<image name="AnimatedSeq" alias="ANIMATED-SEQ" />


Nothing fancy here, we simply just place the first image in the sequence that we want the user to see.

Next we want to create a var that we can use to track the sequence and to use in showing the appropriate image. So we have a simple oninit action that sets the var:frameCount to 0 upon loading the app.

<assign property="var:frameCount" value="0" />

This var shows that we want to make sure that our images are sequenced and named appropriately. So instead of the image strip requirement of a prefix and 4 digit number, we can simplify this. We CAN optionally add a prefix, but it's not required, here I used 'mySeq' then just start you numbering at 0.

mySeq0.jpg, mySeq1.jpg mySeq2.jpg, mySeq3.jpg, etc...

In my example above you will see the number '26' in a few places, this is the total images my sequence requires.

Let's take a look at the action 'loop'.

I have a conditional statement that leads off the action and checks the var:frameCount value.

<if lhs="[var:frameCount]" operator="lte" rhs="26">

This will make sure that once we kick off this action to animate our sequence that we are within the bounds of our sequence numbering and then using that var: perform a load action on the source of the image.

<load source="graphics/mySeq[var:frameCount].jpg" target="ANIMATED-SEQ"/>

Here, since we are starting the animation we will see mySeq0.jpg first be placed in the load. Then immediately following the load (remember we are in a sync) we increment the var:frameCount with an eval: statement:

<assign property="var:frameCount" value="[eval: [var:frameCount] + 1]" />

Now we will create two sibling conditional statement to fork the action and decide if we are done with the animation or need to loop the action over itself and continue incrementing the sequence until we hit 26.

<if lhs="[var:frameCount]" operator="lt" rhs="26">

The first conditional checks to see if our var:frameCount is less than our last slide, 26. If so, we ask the action to start again. And in doing so the action will now go and load slide mySeq1.jpg and increment the var:frameCount to 2 and continue this pattern until it hits our other conditional statement:

<if lhs="[var:frameCount]" operator="=" rhs="26">

Once the var:frameCount hits our ceiling in the sequence, I have placed an alert to just verify the sequence has completed.

While this may initial seem like a complex solution to a control iOS provides, the control and sequencing makes the implementation very repeatable and reliable without losing performance on the device. This also gives a very nice introduction into the power of looped actions and conditional statements.

Please let me know if you have any questions.